admin pings: truescore requirement and exclude shadowban and make a permission

master
justcool393 2022-10-22 19:45:15 -05:00
parent cc3fb59ccd
commit a2c16534a4
2 changed files with 4 additions and 2 deletions

View File

@ -91,8 +91,8 @@ def NOTIFY_USERS(text, v):
names = set(m.group(2) for m in mention_regex.finditer(text)) names = set(m.group(2) for m in mention_regex.finditer(text))
for user in get_users(names, graceful=True): for user in get_users(names, graceful=True):
if user.username == 'jannies': 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 > 1).all()] admins = [x[0] for x in g.db.query(User.id).filter(User.admin_level >= PERMS['NOTIFICATIONS_ADMIN_PING']).all()]
notify_users.update(admins) notify_users.update(admins)
elif v.id != user.id and not v.any_block_exists(user): elif v.id != user.id and not v.any_block_exists(user):
notify_users.add(user.id) notify_users.add(user.id)

View File

@ -221,6 +221,7 @@ PERMS = { # Minimum admin_level to perform action.
'SITE_SETTINGS_UNDER_ATTACK': 3, 'SITE_SETTINGS_UNDER_ATTACK': 3,
'SITE_CACHE_PURGE_CDN': 3, 'SITE_CACHE_PURGE_CDN': 3,
'SITE_CACHE_DUMP_INTERNAL': 2, 'SITE_CACHE_DUMP_INTERNAL': 2,
'NOTIFICATIONS_ADMIN_PING': 2,
'NOTIFICATIONS_HOLE_INACTIVITY_DELETION': 2, 'NOTIFICATIONS_HOLE_INACTIVITY_DELETION': 2,
'NOTIFICATIONS_HOLE_CREATION': 2, 'NOTIFICATIONS_HOLE_CREATION': 2,
'NOTIFICATIONS_FROM_SHADOWBANNED_USERS': 3, '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 COMMENT_MAX_DEPTH = 200
TRANSFER_MESSAGE_LENGTH_LIMIT = 200 # do not make larger than 10000 characters (comment limit) without altering the table 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 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 LOGGEDIN_ACTIVE_TIME = 15 * 60
PFP_DEFAULT_MARSEY = True PFP_DEFAULT_MARSEY = True