diff --git a/files/classes/user.py b/files/classes/user.py index 96e3350ad..03160b4d9 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -573,7 +573,7 @@ class User(Base): @property @lazy def modaction_num(self): - if self.admin_level < 2: return 0 + if self.admin_level < PERMS['ADMIN_MOP_VISIBLE']: return 0 return g.db.query(ModAction).filter_by(user_id=self.id).count() @property diff --git a/files/helpers/alerts.py b/files/helpers/alerts.py index ff777a7e2..ba5aac9b6 100644 --- a/files/helpers/alerts.py +++ b/files/helpers/alerts.py @@ -95,7 +95,7 @@ def NOTIFY_USERS(text, v): notify_users.add(user.id) if SITE_NAME == "WPD" and 'daisy' in text.lower(): - admin_ids = [x[0] for x in g.db.query(User.id).filter(User.admin_level > 0).all()] + admin_ids = [x[0] for x in g.db.query(User.id).filter(User.admin_level >= PERMS['NOTIFICATIONS_FOR_SPECIFIC_WPD_COMMENTS']).all()] notify_users.update(admin_ids) return notify_users - bots diff --git a/files/helpers/const.py b/files/helpers/const.py index 8b8c05e35..5867b7cf0 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -163,6 +163,7 @@ PERMS = { # Minimum admin_level to perform action. 'ADMIN_REMOVE': 3, 'ADMIN_ADD_PERM_LEVEL': 2, # permission level given when user added via site 'ADMIN_ACTIONS_REVERT': 3, + 'ADMIN_MOP_VISIBLE': 2, 'SITE_SETTINGS': 3, 'SITE_SETTINGS_SIDEBARS_BANNERS_BADGES': 3, 'SITE_SETTINGS_SNAPPY_QUOTES': 3, @@ -174,6 +175,7 @@ PERMS = { # Minimum admin_level to perform action. 'NOTIFICATIONS_HOLE_CREATION': 2, 'NOTIFICATIONS_FROM_SHADOWBANNED_USERS': 3, 'NOTIFICATIONS_MODMAIL': 3, + 'NOTIFICATIONS_FOR_SPECIFIC_WPD_COMMENTS': 1, 'MESSAGE_BLOCKED_USERS': 1, } diff --git a/files/routes/static.py b/files/routes/static.py index 28fb3a87d..97c286f19 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -165,7 +165,7 @@ def log(v): next_exists=len(actions)>25 actions=actions[:25] - admins = [x[0] for x in g.db.query(User.username).filter(User.admin_level >= 2).order_by(User.username).all()] + admins = [x[0] for x in g.db.query(User.username).filter(User.admin_level >= PERMS['ADMIN_MOP_VISIBLE']).order_by(User.username).all()] return render_template("log.html", v=v, admins=admins, types=types, admin=admin, type=kind, actions=actions, next_exists=next_exists, page=page) @@ -180,9 +180,9 @@ def log_item(id, v): if not action: abort(404) - admins = [x[0] for x in g.db.query(User.username).filter(User.admin_level > 1).all()] + admins = [x[0] for x in g.db.query(User.username).filter(User.admin_level >= PERMS['ADMIN_MOP_VISIBLE']).all()] - if v and v.admin_level > 1: types = ACTIONTYPES + if v and v.admin_level >= PERMS['USER_SHADOWBAN']: types = ACTIONTYPES else: types = ACTIONTYPES2 return render_template("log.html", v=v, actions=[action], next_exists=False, page=1, action=action, admins=admins, types=types) diff --git a/files/templates/chat.html b/files/templates/chat.html index 6e716725c..d3e64dac2 100644 --- a/files/templates/chat.html +++ b/files/templates/chat.html @@ -32,7 +32,7 @@ id="root" data-id="{{v.id}}" data-username="{{v.username}}" - data-admin="{{v.admin_level > 1}}" + data-admin="{{v.admin_level >= PERMS['ADMIN_MOP_VISIBLE']}}" data-censored="{{v.slurreplacer}}" data-sitename="{{SITE_NAME}}" data-themecolor="{{v.themecolor}}" diff --git a/files/templates/userpage.html b/files/templates/userpage.html index c4da5afda..1f7c161d9 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -87,7 +87,7 @@ {% endif %} - {% if u.admin_level > 1 %} + {% if u.admin_level >= PERMS['ADMIN_MOP_VISIBLE'] %} @@ -470,7 +470,7 @@   {% endif %} - {% if u.admin_level > 1 %} + {% if u.admin_level >= PERMS['ADMIN_MOP_VISIBLE'] %}