view sorted admin list and message blocked users

master
justcool393 2022-10-05 22:16:09 -07:00
parent 68851ed986
commit 38f3c7ed55
3 changed files with 4 additions and 2 deletions

View File

@ -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 = {

View File

@ -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()

View File

@ -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()