From b17ea4fd377d1b4b0f2d3322cb1e2258cacb14a0 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Mon, 31 Oct 2022 18:11:49 -0500 Subject: [PATCH] awards: only restrict admins if award feature flag set --- files/routes/admin.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index fc1562624..698fb481d 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -1029,7 +1029,7 @@ def unban_user(user_id, v): if not user.is_banned: abort(400) - if user.ban_reason and user.ban_reason.startswith('1-Day ban award'): + if FEATURES["AWARDS"] and user.ban_reason and user.ban_reason.startswith('1-Day ban award'): abort(403, "You can't undo a ban award!") user.is_banned = 0 @@ -1092,7 +1092,7 @@ def remove_post(post_id, v): post = get_post(post_id) post.is_banned = True post.is_approved = None - if post.stickied and not post.stickied.endswith(PIN_AWARD_TEXT): + if FEATURES["AWARDS"] and post.stickied and not post.stickied.endswith(PIN_AWARD_TEXT): post.stickied = None post.is_pinned = False post.ban_reason = v.username @@ -1177,7 +1177,7 @@ def distinguish_post(post_id, v): def sticky_post(post_id, v): post = get_post(post_id) if post.is_banned: abort(403, "Can't sticky removed posts!") - if post.stickied and post.stickied.endswith(PIN_AWARD_TEXT): + if FEATURES["AWARDS"] and post.stickied and post.stickied.endswith(PIN_AWARD_TEXT): abort(403, "Can't pin award pins!") pins = g.db.query(Submission).filter(Submission.stickied != None, Submission.is_banned == False).count() @@ -1216,7 +1216,7 @@ def sticky_post(post_id, v): def unsticky_post(post_id, v): post = get_post(post_id) if post.stickied: - if post.stickied.endswith(PIN_AWARD_TEXT): abort(403, "Can't unpin award pins!") + if FEATURES["AWARDS"] and post.stickied.endswith(PIN_AWARD_TEXT): abort(403, "Can't unpin award pins!") if post.author_id == LAWLZ_ID and post.stickied_utc and SITE_NAME == 'rDrama': abort(403, "Can't unpin lawlzposts!") post.stickied = None @@ -1263,11 +1263,10 @@ def sticky_comment(cid, v): @app.post("/unsticky_comment/") @admin_level_required(PERMS['POST_COMMENT_MODERATION']) def unsticky_comment(cid, v): - comment = get_comment(cid, v=v) if comment.stickied: - if comment.stickied.endswith(PIN_AWARD_TEXT): abort(403, "Can't unpin award pins!") + if FEATURES["AWARDS"] and comment.stickied.endswith(PIN_AWARD_TEXT): abort(403, "Can't unpin award pins!") comment.stickied = None g.db.add(comment)