forked from rDrama/rDrama
dont generate notifs that wont be seen
parent
9dc48c7acf
commit
d44bd1241c
|
@ -353,15 +353,14 @@ def messagereply(v):
|
|||
execute_under_siege(v, c, c.body_html, 'message')
|
||||
|
||||
if user_id and user_id not in {v.id, MODMAIL_ID} | BOT_IDs:
|
||||
notif = g.db.query(Notification).filter_by(comment_id=c.id, user_id=user_id).one_or_none()
|
||||
if not notif:
|
||||
notif = Notification(comment_id=c.id, user_id=user_id)
|
||||
g.db.add(notif)
|
||||
if User.can_see(user, v):
|
||||
notif = g.db.query(Notification).filter_by(comment_id=c.id, user_id=user_id).one_or_none()
|
||||
if not notif:
|
||||
notif = Notification(comment_id=c.id, user_id=user_id)
|
||||
g.db.add(notif)
|
||||
|
||||
title = f'New message from @{c.author_name}'
|
||||
|
||||
url = f'{SITE_FULL}/notifications/messages'
|
||||
|
||||
push_notif({user_id}, title, body, url)
|
||||
|
||||
top_comment = c.top_comment
|
||||
|
|
|
@ -373,6 +373,9 @@ def comment(v):
|
|||
if parent_user.id != v.id and notify_op:
|
||||
notify_users.add(parent_user.id)
|
||||
|
||||
if v.shadowbanned:
|
||||
notify_users = [x[0] for x in g.db.query(User.id).filter(User.id.in_(notify_users), User.admin_level >= PERMS['USER_SHADOWBAN']).all()]
|
||||
|
||||
for x in notify_users-BOT_IDs:
|
||||
n = Notification(comment_id=c.id, user_id=x)
|
||||
g.db.add(n)
|
||||
|
@ -723,6 +726,9 @@ def edit_comment(cid, v):
|
|||
if notify_users == 'everyone':
|
||||
alert_everyone(c.id)
|
||||
else:
|
||||
if v.shadowbanned:
|
||||
notify_users = [x[0] for x in g.db.query(User.id).filter(User.id.in_(notify_users), User.admin_level >= PERMS['USER_SHADOWBAN']).all()]
|
||||
|
||||
for x in notify_users-BOT_IDs:
|
||||
notif = g.db.query(Notification).filter_by(comment_id=c.id, user_id=x).one_or_none()
|
||||
if not notif:
|
||||
|
|
|
@ -665,7 +665,7 @@ def message2(v, username=None, id=None):
|
|||
execute_under_siege(v, c, c.body_html, 'message')
|
||||
c.top_comment_id = c.id
|
||||
|
||||
if user.id not in BOT_IDs:
|
||||
if user.id not in BOT_IDs and User.can_see(user, v):
|
||||
g.db.flush()
|
||||
notif = g.db.query(Notification).filter_by(comment_id=c.id, user_id=user.id).one_or_none()
|
||||
if not notif:
|
||||
|
|
Loading…
Reference in New Issue