forked from rDrama/rDrama
Fix notification count with muted modmails.
parent
e90226d712
commit
e027909357
|
@ -603,12 +603,19 @@ class User(Base):
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def notifications_count(self):
|
def notifications_count(self):
|
||||||
notifs = g.db.query(Notification.user_id).join(Comment).filter(
|
notifs = (
|
||||||
Notification.user_id == self.id, Notification.read == False,
|
g.db.query(Notification.user_id)
|
||||||
Comment.is_banned == False, Comment.deleted_utc == 0)
|
.join(Comment).join(Comment.author)
|
||||||
|
.filter(
|
||||||
|
Notification.read == False,
|
||||||
|
Notification.user_id == self.id,
|
||||||
|
Comment.is_banned == False,
|
||||||
|
Comment.deleted_utc == 0,
|
||||||
|
not_(and_(Comment.sentto == 2, User.is_muted)),
|
||||||
|
))
|
||||||
|
|
||||||
if not self.can_see_shadowbanned:
|
if not self.can_see_shadowbanned:
|
||||||
notifs = notifs.join(Comment.author).filter(User.shadowbanned == None)
|
notifs = notifs.filter(User.shadowbanned == None)
|
||||||
|
|
||||||
return notifs.count() + self.post_notifications_count + self.modaction_notifications_count
|
return notifs.count() + self.post_notifications_count + self.modaction_notifications_count
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue