From a2c16534a4cfe52e7ee3717cedb78060a3046312 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Sat, 22 Oct 2022 19:45:15 -0500 Subject: [PATCH] admin pings: truescore requirement and exclude shadowban and make a permission --- files/helpers/alerts.py | 4 ++-- files/helpers/const.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/files/helpers/alerts.py b/files/helpers/alerts.py index 977e8a50e..2d6b99353 100644 --- a/files/helpers/alerts.py +++ b/files/helpers/alerts.py @@ -91,8 +91,8 @@ def NOTIFY_USERS(text, v): names = set(m.group(2) for m in mention_regex.finditer(text)) for user in get_users(names, graceful=True): - if user.username == 'jannies': - admins = [x[0] for x in g.db.query(User.id).filter(User.admin_level > 1).all()] + if user.username == 'jannies' and v.truecoins >= ADMIN_PING_TRUESCORE_MINIMUM and not v.shadowbanned: + admins = [x[0] for x in g.db.query(User.id).filter(User.admin_level >= PERMS['NOTIFICATIONS_ADMIN_PING']).all()] notify_users.update(admins) elif v.id != user.id and not v.any_block_exists(user): notify_users.add(user.id) diff --git a/files/helpers/const.py b/files/helpers/const.py index a3c67d7c1..586ccd2d7 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -221,6 +221,7 @@ PERMS = { # Minimum admin_level to perform action. 'SITE_SETTINGS_UNDER_ATTACK': 3, 'SITE_CACHE_PURGE_CDN': 3, 'SITE_CACHE_DUMP_INTERNAL': 2, + 'NOTIFICATIONS_ADMIN_PING': 2, 'NOTIFICATIONS_HOLE_INACTIVITY_DELETION': 2, 'NOTIFICATIONS_HOLE_CREATION': 2, 'NOTIFICATIONS_FROM_SHADOWBANNED_USERS': 3, @@ -330,6 +331,7 @@ COMMENT_BODY_HTML_LENGTH_LIMIT = 20000 # do not make larger than 20000 character COMMENT_MAX_DEPTH = 200 TRANSFER_MESSAGE_LENGTH_LIMIT = 200 # do not make larger than 10000 characters (comment limit) without altering the table MIN_REPOST_CHECK_URL_LENGTH = 9 # also change the constant in checkRepost() of submit.js +ADMIN_PING_TRUESCORE_MINIMUM = 500 LOGGEDIN_ACTIVE_TIME = 15 * 60 PFP_DEFAULT_MARSEY = True