forked from rDrama/rDrama
do notify jannies
parent
e84676cd50
commit
8ac49ae416
|
@ -303,40 +303,42 @@ def comment(v):
|
||||||
execute_longpostbot(c, level, body, body_html, post_target, v)
|
execute_longpostbot(c, level, body, body_html, post_target, v)
|
||||||
execute_zozbot(c, level, 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':
|
if notify_users == 'everyone':
|
||||||
alert_everyone(c.id)
|
alert_everyone(c.id)
|
||||||
else:
|
else:
|
||||||
push_notif(notify_users, f'New mention of you by @{c.author_name}', c.body, c)
|
push_notif(notify_users, f'New mention of you by @{c.author_name}', c.body, c)
|
||||||
|
|
||||||
if c.level == 1 and posting_to_post:
|
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)]
|
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:
|
if parent_user.id != v.id and notify_op:
|
||||||
notify_users.add(parent_user.id)
|
notify_users.add(parent_user.id)
|
||||||
|
|
||||||
notify_users -= BOT_IDs
|
notify_users -= BOT_IDs
|
||||||
|
|
||||||
if v.shadowbanned or c.is_banned:
|
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()]
|
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:
|
if c.pinned == "Admin Note":
|
||||||
n = Notification(comment_id=c.id, user_id=x)
|
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()]
|
||||||
g.db.add(n)
|
|
||||||
|
|
||||||
if parent_user.id != v.id and notify_op:
|
for x in notify_users:
|
||||||
if isinstance(parent, User):
|
n = Notification(comment_id=c.id, user_id=x)
|
||||||
title = f"New comment on your wall by @{c.author_name}"
|
g.db.add(n)
|
||||||
else:
|
|
||||||
title = f'New reply by @{c.author_name}'
|
|
||||||
|
|
||||||
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,
|
vote = CommentVote(user_id=v.id,
|
||||||
comment_id=c.id,
|
comment_id=c.id,
|
||||||
|
@ -668,6 +670,9 @@ def edit_comment(cid, v):
|
||||||
else:
|
else:
|
||||||
notify_users -= BOT_IDs
|
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:
|
for x in notify_users:
|
||||||
notif = g.db.query(Notification).filter_by(comment_id=c.id, user_id=x).one_or_none()
|
notif = g.db.query(Notification).filter_by(comment_id=c.id, user_id=x).one_or_none()
|
||||||
if not notif:
|
if not notif:
|
||||||
|
|
Loading…
Reference in New Issue