From 379ae664a342513650b39c553f9c4e9c5130d430 Mon Sep 17 00:00:00 2001 From: TLSM Date: Thu, 2 Jun 2022 19:45:33 -0400 Subject: [PATCH] Make PIN_LIMIT a per-site constant. --- files/helpers/const.py | 3 +++ files/routes/admin.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index d92f650e6..1489f8a78 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -128,6 +128,8 @@ AGENDAPOSTER_PHRASE = 'trans lives matter' AGENDAPOSTER_MSG = """Hi @{username},\n\nYour {type} has been automatically removed because you forgot to include `{AGENDAPOSTER_PHRASE}`.\n\nDon't worry, we're here to help! We won't let you post or comment anything that doesn't express your love and acceptance towards the trans community. Feel free to resubmit your {type} with `{AGENDAPOSTER_PHRASE}` included. \n\n*This is an automated message; if you need help, you can message us [here](/contact).*""" +PIN_LIMIT = 3 + if SITE in {'rdrama.net','devrama.xyz'}: HOLE_COST = 200000 NOTIFICATIONS_ID = 1046 @@ -176,6 +178,7 @@ if SITE in {'rdrama.net','devrama.xyz'}: elif SITE == "pcmemes.net": HOLE_COST = 10000 + PIN_LIMIT = 6 NOTIFICATIONS_ID = 1046 AUTOJANNY_ID = 1050 SNAPPY_ID = 261 diff --git a/files/routes/admin.py b/files/routes/admin.py index 61ae52868..273bf203d 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -1356,11 +1356,11 @@ def sticky_post(post_id, v): post = g.db.query(Submission).filter_by(id=post_id).one_or_none() if post and not post.stickied: pins = g.db.query(Submission).filter(Submission.stickied != None, Submission.is_banned == False).count() - if pins > 2: + if pins >= PIN_LIMIT: if v.admin_level > 2: post.stickied = v.username post.stickied_utc = int(time.time()) + 3600 - else: return {"error": "Can't exceed 3 pinned posts limit!"}, 403 + else: return {"error": f"Can't exceed {PIN_LIMIT} pinned posts limit!"}, 403 else: post.stickied = v.username g.db.add(post)