do notify jannies

pull/225/head
Aevann 2024-03-06 00:32:39 +02:00
parent e84676cd50
commit 8ac49ae416
1 changed files with 29 additions and 24 deletions

View File

@ -303,40 +303,42 @@ def comment(v):
execute_longpostbot(c, level, body, body_html, post_target, v)
execute_zozbot(c, level, post_target, v)
if c.pinned != "Admin Note":
notify_users = NOTIFY_USERS(body, v, ghost=c.ghost, obj=c, commenters_ping_post_id=commenters_ping_post_id)
notify_users = NOTIFY_USERS(body, v, ghost=c.ghost, obj=c, commenters_ping_post_id=commenters_ping_post_id)
if notify_users == 'everyone':
alert_everyone(c.id)
else:
push_notif(notify_users, f'New mention of you by @{c.author_name}', c.body, c)
if notify_users == 'everyone':
alert_everyone(c.id)
else:
push_notif(notify_users, f'New mention of you by @{c.author_name}', c.body, c)
if c.level == 1 and posting_to_post:
subscriber_ids = [x[0] for x in g.db.query(Subscription.user_id).filter(Subscription.post_id == post_target.id, Subscription.user_id != v.id)]
if c.level == 1 and posting_to_post:
subscriber_ids = [x[0] for x in g.db.query(Subscription.user_id).filter(Subscription.post_id == post_target.id, Subscription.user_id != v.id)]
notify_users.update(subscriber_ids)
notify_users.update(subscriber_ids)
push_notif(subscriber_ids, f'New comment in subscribed thread by @{c.author_name}', c.body, c)
push_notif(subscriber_ids, f'New comment in subscribed thread by @{c.author_name}', c.body, c)
if parent_user.id != v.id and notify_op:
notify_users.add(parent_user.id)
if parent_user.id != v.id and notify_op:
notify_users.add(parent_user.id)
notify_users -= BOT_IDs
notify_users -= BOT_IDs
if v.shadowbanned or c.is_banned:
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()]
if v.shadowbanned or c.is_banned:
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:
n = Notification(comment_id=c.id, user_id=x)
g.db.add(n)
if c.pinned == "Admin Note":
notify_users = [x[0] for x in g.db.query(User.id).filter(User.id.in_(notify_users), User.admin_level >= PERMS['ADMIN_NOTES']).all()]
if parent_user.id != v.id and notify_op:
if isinstance(parent, User):
title = f"New comment on your wall by @{c.author_name}"
else:
title = f'New reply by @{c.author_name}'
for x in notify_users:
n = Notification(comment_id=c.id, user_id=x)
g.db.add(n)
push_notif({parent_user.id}, title, c.body, c)
if parent_user.id != v.id and notify_op:
if isinstance(parent, User):
title = f"New comment on your wall by @{c.author_name}"
else:
title = f'New reply by @{c.author_name}'
push_notif({parent_user.id}, title, c.body, c)
vote = CommentVote(user_id=v.id,
comment_id=c.id,
@ -668,6 +670,9 @@ def edit_comment(cid, v):
else:
notify_users -= BOT_IDs
if c.pinned == "Admin Note":
notify_users = [x[0] for x in g.db.query(User.id).filter(User.id.in_(notify_users), User.admin_level >= PERMS['ADMIN_NOTES']).all()]
for x in notify_users:
notif = g.db.query(Notification).filter_by(comment_id=c.id, user_id=x).one_or_none()
if not notif: