From 4560e7e8cd9cb0fe99b9c07a46494759dcdb033b Mon Sep 17 00:00:00 2001 From: Aevann Date: Tue, 16 Apr 2024 23:33:29 +0200 Subject: [PATCH] fix unban awards --- files/routes/awards.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/files/routes/awards.py b/files/routes/awards.py index bd9f2be1f..f5f49ea57 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -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 {ban_reason_link}' - 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 {ban_reason_link}' + author.ban_reason = ban_reason + if kind == "emoji": emoji_behavior = request.values.get("emoji_behavior").strip()