diff --git a/files/classes/user.py b/files/classes/user.py index bc4820e5a..5eda4fee0 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -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, diff --git a/files/routes/notifications.py b/files/routes/notifications.py index 3b24e0b32..e8caa9bf6 100644 --- a/files/routes/notifications.py +++ b/files/routes/notifications.py @@ -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,