Make CARP_ID's flair uneditable by others.

This is a kludge solution that sticks special case logic in places
it shouldn't be. However, community management demands necessitate it
quickly. Of the three ways to change a flair (customtitle), this
prevents using flairlocks and admin flair editing on the user with
CARP_ID. Only the user himself may change his flair through settings.
master
Snakes 2022-06-04 23:34:44 -04:00
parent b6059201c0
commit c2266985b7
2 changed files with 5 additions and 1 deletions

View File

@ -1075,6 +1075,8 @@ def unshadowban(user_id, v):
@limiter.limit("1/second;30/minute;200/hour;1000/day")
@admin_level_required(2)
def admin_title_change(user_id, v):
if CARP_ID > 0 and user_id == CARP_ID:
abort(403)
user = g.db.query(User).filter_by(id=user_id).one_or_none()

View File

@ -240,7 +240,9 @@ def award_thing(v, thing_type, id):
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "flairlock":
new_name = note[:100].replace("𒐪","")
if not new_name and author.flairchanged:
if CARP_ID > 0 and author.id == CARP_ID:
send_repeatable_notification(v.id, "Carp's title is sacred and inviolable. You just wasted a flairlock!")
elif not new_name and author.flairchanged:
author.flairchanged += 86400
else:
author.customtitleplain = new_name