From 1d063e39ab6a21211573b50c5926ed200e869649 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Sat, 12 Nov 2022 04:33:33 -0600 Subject: [PATCH] awards: move sb check to be earlier to avoid a query in rare cases --- files/routes/awards.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/routes/awards.py b/files/routes/awards.py index 4dd8c42e8..6b269c6b3 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -132,6 +132,8 @@ def award_thing(v, thing_type, id): if not thing.parent_submission: abort(404) # don't let users award messages if v.shadowbanned: abort(500) + author = thing.author + if author.shadowbanned: abort(404) kind = request.values.get("kind", "").strip() @@ -158,8 +160,6 @@ def award_thing(v, thing_type, id): note = request.values.get("note", "").strip() - author = thing.author - if author.shadowbanned: abort(404) if SITE == 'rdrama.net' and author.id in (PIZZASHILL_ID, CARP_ID): abort(403, f"@{author.username} is immune to awards.")