From 38f3c7ed55e9d759cd1bd27f6ee00249278aa896 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Wed, 5 Oct 2022 22:16:09 -0700 Subject: [PATCH] view sorted admin list and message blocked users --- files/helpers/const.py | 2 ++ files/routes/static.py | 2 +- files/routes/users.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index 4e8733ac7..8b8c05e35 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -155,6 +155,7 @@ PERMS = { # Minimum admin_level to perform action. 'VIEW_PRIVATE_PROFILES': 2, 'VIEW_ALTS': 2, 'VIEW_PROFILE_VIEWS': 2, + 'VIEW_SORTED_ADMIN_LIST': 3, 'PRINT_MARSEYBUX_FOR_KIPPY_ON_PCMEMES': 3, 'VIEW_ACTIVE_USERS': 2, 'MERGE_USERS': 3, # note: extra check for Aevann @@ -173,6 +174,7 @@ PERMS = { # Minimum admin_level to perform action. 'NOTIFICATIONS_HOLE_CREATION': 2, 'NOTIFICATIONS_FROM_SHADOWBANNED_USERS': 3, 'NOTIFICATIONS_MODMAIL': 3, + 'MESSAGE_BLOCKED_USERS': 1, } FEATURES = { diff --git a/files/routes/static.py b/files/routes/static.py index 5e619cf48..28fb3a87d 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -119,7 +119,7 @@ def patrons(v): @app.get("/badmins") @auth_required def admins(v): - if v and v.admin_level > 2: + if v.admin_level >= PERMS['VIEW_SORTED_ADMIN_LIST']: admins = g.db.query(User).filter(User.admin_level>1).order_by(User.truecoins.desc()).all() admins += g.db.query(User).filter(User.admin_level==1).order_by(User.truecoins.desc()).all() else: admins = g.db.query(User).filter(User.admin_level>0).order_by(User.truecoins.desc()).all() diff --git a/files/routes/users.py b/files/routes/users.py index 13f712b5a..a958fcba9 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -741,7 +741,7 @@ def message2(v, username): if hasattr(user, 'is_blocking') and user.is_blocking: return {"error": "You're blocking this user."}, 403 - if v.admin_level <= 1 and hasattr(user, 'is_blocked') and user.is_blocked: + if v.admin_level <= PERMS['MESSAGE_BLOCKED_USERS'] and hasattr(user, 'is_blocked') and user.is_blocked: return {"error": "This user is blocking you."}, 403 message = request.values.get("message", "").strip()[:10000].strip()