fix unban awards

master
Aevann 2024-04-16 23:33:29 +02:00
parent 28da199b5b
commit 4560e7e8cd
1 changed files with 7 additions and 10 deletions

View File

@ -270,16 +270,6 @@ def award_thing(v, thing_type, id):
can_alter_body = not obj.author.deflector or v == obj.author
if kind in {"ban", "grass"}:
ban_reason_link = f"/{thing_type}/{obj.id}"
if isinstance(obj, Comment):
ban_reason_link += '#context'
ban_reason = f'{quantity} {award_title} award{s} used by @{v.username} on <a href="{ban_reason_link}">{ban_reason_link}</a>'
author.ban_reason = ban_reason
awards = g.db.query(AwardRelationship).filter(
AwardRelationship.kind == kind,
AwardRelationship.user_id == v.id,
@ -301,6 +291,13 @@ def award_thing(v, thing_type, id):
award.note = note
g.db.add(award)
if kind in {"ban", "grass"}:
ban_reason_link = f"/{thing_type}/{obj.id}"
if isinstance(obj, Comment):
ban_reason_link += '#context'
ban_reason = f'{award_title} award{s} used by @{v.username} on <a href="{ban_reason_link}">{ban_reason_link}</a>'
author.ban_reason = ban_reason
if kind == "emoji":
emoji_behavior = request.values.get("emoji_behavior").strip()