on rdrama, extend hole and ping group notifs to everyone active in the past week

pull/221/head
Aevann 2024-01-12 19:15:15 +02:00
parent 65a28daefb
commit 7012caa6ef
3 changed files with 10 additions and 6 deletions

View File

@ -150,6 +150,8 @@ if SITE_NAME == 'rDrama':
patron = "Paypig"
PERMS['NOTIFICATIONS_HOLE_CREATION'] = 0
TAGLINES = (
"largest online LGBTQ+ club",
"largest online furfest",

View File

@ -54,9 +54,10 @@ def create_group(v):
g.db.flush() #Necessary, to make linkfying the ping group in the notification work
admins = [x[0] for x in g.db.query(User.id).filter(User.admin_level >= PERMS['NOTIFICATIONS_HOLE_CREATION'], User.id != v.id)]
for admin in admins:
send_repeatable_notification(admin, f":!marseyparty: !{group} has been created by @{v.username} :marseyparty:")
t = time.time() - 604800
notified_users = [x[0] for x in g.db.query(User.id).filter(User.admin_level >= PERMS['NOTIFICATIONS_HOLE_CREATION'], User.id != v.id, User.last_active > t)]
for user in notified_users:
send_repeatable_notification(user, f":!marseyparty: !{group} has been created by @{v.username} :marseyparty:")
return {"message": f"!{group} created successfully!"}

View File

@ -389,9 +389,10 @@ def create_sub2(v):
mod = Mod(user_id=v.id, hole=hole.name)
g.db.add(mod)
admins = [x[0] for x in g.db.query(User.id).filter(User.admin_level >= PERMS['NOTIFICATIONS_HOLE_CREATION'], User.id != v.id)]
for admin in admins:
send_repeatable_notification(admin, f":!marseyparty: /h/{hole} has been created by @{v.username} :marseyparty:")
t = time.time() - 604800
notified_users = [x[0] for x in g.db.query(User.id).filter(User.admin_level >= PERMS['NOTIFICATIONS_HOLE_CREATION'], User.id != v.id, User.last_active > t)]
for user in notified_users:
send_repeatable_notification(user, f":!marseyparty: /h/{hole} has been created by @{v.username} :marseyparty:")
return redirect(f"/h/{hole}")