forked from rDrama/rDrama
fix this post not being in my notifications even tho i follow /h/slackernews https://rdrama.net/h/slackernews/post/204394/smartest-marseytrain2-lizfongjones-admits-to-tortious
parent
1b3e59b7a7
commit
8b0daa3aa2
|
@ -784,17 +784,19 @@ class User(Base):
|
||||||
@lazy
|
@lazy
|
||||||
def post_notifications_count(self):
|
def post_notifications_count(self):
|
||||||
return g.db.query(Post).filter(
|
return g.db.query(Post).filter(
|
||||||
or_(
|
|
||||||
Post.author_id.in_(self.followed_users),
|
|
||||||
Post.sub.in_(self.followed_subs)
|
|
||||||
),
|
|
||||||
Post.created_utc > self.last_viewed_post_notifs,
|
Post.created_utc > self.last_viewed_post_notifs,
|
||||||
|
or_(
|
||||||
|
Post.sub.in_(self.followed_subs),
|
||||||
|
and_(
|
||||||
|
Post.author_id.in_(self.followed_users),
|
||||||
|
Post.notify == True,
|
||||||
|
Post.ghost == False,
|
||||||
|
),
|
||||||
|
),
|
||||||
Post.deleted_utc == 0,
|
Post.deleted_utc == 0,
|
||||||
Post.is_banned == False,
|
Post.is_banned == False,
|
||||||
Post.private == False,
|
Post.private == False,
|
||||||
Post.notify == True,
|
|
||||||
Post.author_id != self.id,
|
Post.author_id != self.id,
|
||||||
Post.ghost == False,
|
|
||||||
Post.author_id.notin_(self.userblocks),
|
Post.author_id.notin_(self.userblocks),
|
||||||
or_(Post.sub == None, Post.sub.notin_(self.sub_blocks)),
|
or_(Post.sub == None, Post.sub.notin_(self.sub_blocks)),
|
||||||
).count()
|
).count()
|
||||||
|
|
|
@ -166,15 +166,17 @@ def notifications_posts(v):
|
||||||
|
|
||||||
listing = g.db.query(Post).filter(
|
listing = g.db.query(Post).filter(
|
||||||
or_(
|
or_(
|
||||||
Post.author_id.in_(v.followed_users),
|
Post.sub.in_(v.followed_subs),
|
||||||
Post.sub.in_(v.followed_subs)
|
and_(
|
||||||
|
Post.author_id.in_(v.followed_users),
|
||||||
|
Post.notify == True,
|
||||||
|
Post.ghost == False,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Post.deleted_utc == 0,
|
Post.deleted_utc == 0,
|
||||||
Post.is_banned == False,
|
Post.is_banned == False,
|
||||||
Post.private == False,
|
Post.private == False,
|
||||||
Post.notify == True,
|
|
||||||
Post.author_id != v.id,
|
Post.author_id != v.id,
|
||||||
Post.ghost == False,
|
|
||||||
Post.author_id.notin_(v.userblocks),
|
Post.author_id.notin_(v.userblocks),
|
||||||
or_(Post.sub == None, Post.sub.notin_(v.sub_blocks)),
|
or_(Post.sub == None, Post.sub.notin_(v.sub_blocks)),
|
||||||
).options(load_only(Post.id))
|
).options(load_only(Post.id))
|
||||||
|
|
Loading…
Reference in New Issue