Nojs chat: only deverify user when they leave a message

Matches the behaviour of the js chat. Makes it so if you submit an empty
message but with a correct captcha, you won't be deverified and given another
captcha until you successfully send a message (and exceed the flood threshold).
Previously you could fill in the captcha with no message and be given back a
new captcha, which doesn't make that much sense.
このコミットが含まれているのは:
n9k 2022-03-02 09:16:10 +00:00
コミット 2763891a4e
1個のファイルの変更3行の追加2行の削除

ファイルの表示

@ -103,7 +103,7 @@ async def nojs_submit_message(user):
try:
# If the comment is empty but the captcha was just solved,
# be lenient: don't raise an exception and don't create a notice
add_chat_message(
message_was_added = add_chat_message(
user,
nonce,
comment,
@ -113,8 +113,9 @@ async def nojs_submit_message(user):
notice, *_ = e.args
state_id = add_state(user, notice=notice, comment=comment)
else:
deverify(user)
state_id = None
if message_was_added:
deverify(user)
return redirect(url_for(
'nojs_form',