try fixing ghost modmail notifs

pull/222/head
Aevann 2024-02-01 22:30:31 +02:00
parent a27a6726e3
commit 05a56ac429
1 changed files with 2 additions and 2 deletions

View File

@ -785,11 +785,11 @@ class User(Base):
def modmail_notifications_count(self):
if self.admin_level < PERMS['NOTIFICATIONS_MODMAIL']:
return 0
return g.db.query(Comment).distinct(Comment.top_comment_id).filter(
return g.db.query(Comment.top_comment_id).filter(
Comment.author_id != self.id,
Comment.sentto == MODMAIL_ID,
Comment.created_utc > self.last_viewed_modmail_notifs,
).count()
).group_by(Comment.top_comment_id).count()
@property
@lazy