mop visibility, WPD notifications, and a fix with shadowbans

remotes/1693176582716663532/tmp_refs/heads/watchparty
justcool393 2022-10-05 22:25:45 -07:00
parent 38f3c7ed55
commit dc5a132583
6 changed files with 10 additions and 8 deletions

View File

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

View File

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

View File

@ -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,
}

View File

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

View File

@ -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}}"

View File

@ -87,7 +87,7 @@
<span id="profile--verified"><i class="fas fa-badge-check align-middle ml-2 {% if u.verified=='Glowiefied' %}glow{% endif %}" style="color:{% if u.verifiedcolor %}#{{u.verifiedcolor}}{% else %}#1DA1F2{% endif %}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{u.verified}}"></i></span>
{% endif %}
{% if u.admin_level > 1 %}
{% if u.admin_level >= PERMS['ADMIN_MOP_VISIBLE'] %}
<span id="profile--mop">
<i class="fas fa-broom text-admin align-middle ml-2" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Admin"></i>
</span>
@ -470,7 +470,7 @@
<span id="profile-mobile--verified"><i class="fas fa-badge-check align-middle ml-2 {% if u.verified=='Glowiefied' %}glow{% endif %}" style="color:{% if u.verifiedcolor %}#{{u.verifiedcolor}}{% else %}#1DA1F2{% endif %}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{u.verified}}"></i></span>&nbsp;
{% endif %}
{% if u.admin_level > 1 %}
{% if u.admin_level >= PERMS['ADMIN_MOP_VISIBLE'] %}
<span id="profile-mobile--mop">
<i class="fas fa-broom text-admin align-middle ml-1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Admin"></i>
</span>