disable ping group notifs for normal users

pull/221/head
Aevann 2024-01-26 14:36:04 +02:00
parent 3b50a64ef7
commit d02ee5abd2
2 changed files with 4 additions and 8 deletions

View File

@ -176,6 +176,7 @@ PERMS = { # Minimum admin_level to perform action.
'ENABLE_VOTE_BUTTONS_ON_USER_PAGE': 1,
'NOTIFICATIONS_HOLE_INACTIVITY_DELETION': 1,
'NOTIFICATIONS_HOLE_CREATION': 1,
'NOTIFICATIONS_GROUP_CREATION': 1,
'NOTIFICATIONS_MODERATOR_ACTIONS': 1,
'IS_PERMA_PROGSTACKED': 2,

View File

@ -54,14 +54,9 @@ def create_group(v):
g.db.flush() #Necessary, to make linkfying the ping group in the notification work
text = f":!marseyparty: !{group} has been created by @{v.username} :marseyparty:"
text_html = sanitize(text, blackjack="notification")
cid = create_comment(text_html)
t = time.time() - 604800
excluded_ids = (v.id, 556, 868, 6289, 21238)
notified_users = [x[0] for x in g.db.query(User.id).filter(User.admin_level >= PERMS['NOTIFICATIONS_HOLE_CREATION'], User.last_active > t, User.id.notin_(excluded_ids))]
for uid in notified_users:
add_notif(cid, uid, text, check_existing=False)
admins = [x[0] for x in g.db.query(User.id).filter(User.admin_level >= PERMS['NOTIFICATIONS_GROUP_CREATION'], User.id != v.id)]
for admin in admins:
send_repeatable_notification(admin, f":!marseyparty: !{group} has been created by @{v.username} :marseyparty:")
return {"message": f"!{group} created successfully!"}