forked from rDrama/rDrama
make sure shadowbanned-cels cant generate push notifs
parent
81e8d09cd1
commit
e1eecfc0f2
|
@ -215,6 +215,9 @@ def NOTIFY_USERS(text, v, oldtext=None, ghost=False, log_cost=None, followers_pi
|
|||
|
||||
|
||||
def push_notif(uids, title, body, url_or_comment):
|
||||
if g.v.shadowbanned:
|
||||
return
|
||||
|
||||
if VAPID_PUBLIC_KEY == DEFAULT_CONFIG_VALUE:
|
||||
return
|
||||
|
||||
|
|
|
@ -370,7 +370,7 @@ def comment(v):
|
|||
n = Notification(comment_id=c.id, user_id=x)
|
||||
g.db.add(n)
|
||||
|
||||
if parent_user.id != v.id and not v.shadowbanned:
|
||||
if parent_user.id != v.id:
|
||||
if isinstance(parent, User):
|
||||
title = f"New comment on your wall by @{c.author_name}"
|
||||
else:
|
||||
|
@ -710,8 +710,7 @@ def edit_comment(cid, v):
|
|||
if not notif:
|
||||
n = Notification(comment_id=c.id, user_id=x)
|
||||
g.db.add(n)
|
||||
if not v.shadowbanned:
|
||||
push_notif({x}, f'New mention of you by @{c.author_name}', c.body, c)
|
||||
push_notif({x}, f'New mention of you by @{c.author_name}', c.body, c)
|
||||
|
||||
|
||||
g.db.flush()
|
||||
|
|
|
@ -663,12 +663,11 @@ def message2(v, username=None, id=None):
|
|||
g.db.add(notif)
|
||||
|
||||
|
||||
if not v.shadowbanned:
|
||||
title = f'New message from @{c.author_name}'
|
||||
title = f'New message from @{c.author_name}'
|
||||
|
||||
url = f'{SITE_FULL}/notifications/messages'
|
||||
url = f'{SITE_FULL}/notifications/messages'
|
||||
|
||||
push_notif({user.id}, title, body, url)
|
||||
push_notif({user.id}, title, body, url)
|
||||
|
||||
return {"message": "Message sent!"}
|
||||
|
||||
|
@ -745,12 +744,11 @@ def messagereply(v):
|
|||
notif = Notification(comment_id=c.id, user_id=user_id)
|
||||
g.db.add(notif)
|
||||
|
||||
if not v.shadowbanned:
|
||||
title = f'New message from @{c.author_name}'
|
||||
title = f'New message from @{c.author_name}'
|
||||
|
||||
url = f'{SITE_FULL}/notifications/messages'
|
||||
url = f'{SITE_FULL}/notifications/messages'
|
||||
|
||||
push_notif({user_id}, title, body, url)
|
||||
push_notif({user_id}, title, body, url)
|
||||
|
||||
top_comment = c.top_comment
|
||||
|
||||
|
|
Loading…
Reference in New Issue