Aevann 2023-05-16 01:51:37 +03:00
parent cd88e4a4d6
commit ad121dd9c7
1 changed files with 8 additions and 8 deletions

View File

@ -350,6 +350,9 @@ def award_thing(v, thing_type, id):
badge_grant(user=author, badge_id=96)
elif kind == "namelock":
new_name = note.strip()
if not new_name and author.namechanged:
author.namechanged += 86400
else:
if not valid_username_regex.fullmatch(new_name):
abort(400, "Invalid username")
@ -357,9 +360,6 @@ def award_thing(v, thing_type, id):
if existing:
abort(400, f"@{new_name} is already taken!")
if not new_name and author.prelock_username:
author.namechanged += 86400
else:
author.prelock_username = author.username
author.username = new_name
author.namechanged = int(time.time()) + 86400