From d9844231c725074a7a66d1cacf802be687290251 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 1 Jul 2022 00:41:11 +0200 Subject: [PATCH] fix replies to modmail not notifying the sender --- files/routes/users.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/files/routes/users.py b/files/routes/users.py index 9f7998a2d..e04320817 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -767,14 +767,16 @@ def messagereply(v): if c.top_comment.sentto == 2: - admins = g.db.query(User).filter(User.admin_level > 2, User.id != v.id).all() + admins = [x[0] for x in g.db.query(User.id).filter(User.admin_level > 2, User.id != v.id).all()] + if parent.author.id not in admins: + admins.append(parent.author.id) + for admin in admins: - notif = Notification(comment_id=c.id, user_id=admin.id) + notif = Notification(comment_id=c.id, user_id=admin) g.db.add(notif) ids = [c.top_comment.id] + [x.id for x in c.top_comment.replies(None)] - uids = [x.id for x in admins] - notifications = g.db.query(Notification).filter(Notification.comment_id.in_(ids), Notification.user_id.in_(uids)) + notifications = g.db.query(Notification).filter(Notification.comment_id.in_(ids), Notification.user_id.in_(admins)) for n in notifications: g.db.delete(n)