fix muted users not notifying the person they reply to

pull/142/head
Aevann 2023-03-19 10:29:58 +02:00
parent 20eef6e063
commit 62fcaec40d
2 changed files with 11 additions and 3 deletions

View File

@ -625,9 +625,13 @@ class User(Base):
.filter(
Notification.read == False,
Notification.user_id == self.id,
not_(and_(Comment.sentto == MODMAIL_ID, User.is_muted)),
))
if self.admin_level >= PERMS['VIEW_MODMAIL']:
notifs = notifs.filter(
not_(and_(Comment.sentto != None, Comment.sentto == MODMAIL_ID, User.is_muted))
)
if not self.can_see_shadowbanned:
notifs = notifs.filter(
User.shadowbanned == None,

View File

@ -301,12 +301,16 @@ def notifications(v:User):
n.read = True
g.db.add(n)
comments = g.db.query(Comment, Notification).join(Notification.comment).join(Comment.author).filter(
comments = g.db.query(Comment, Notification).join(Notification.comment).filter(
Notification.user_id == v.id,
or_(Comment.sentto == None, Comment.sentto != v.id),
not_(and_(Comment.sentto == MODMAIL_ID, User.is_muted)),
)
if v.admin_level >= PERMS['VIEW_MODMAIL']:
comments = comments.join(Comment.author).filter(
not_(and_(Comment.sentto != None, Comment.sentto == MODMAIL_ID, User.is_muted))
)
if v.admin_level < PERMS['USER_SHADOWBAN']:
comments = comments.filter(
Comment.is_banned == False,