Fix notifications from blocked users (#711)

This commit is contained in:
Walter Miller 2023-11-08 07:45:08 -05:00 committed by GitHub
parent 52268047b3
commit a856dcbf3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -83,6 +83,9 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None):
blocked.c.user_id == Comment.author_id,
isouter=True
)
# TODO (wmill) This looks wrong to me. It adds on new properties to all comments to use voted/blocked/blocking status in rendering.
# But it needs to be repeated if you ever want to render comments anywhere else.
output = []
for c in comments:

View file

@ -62,10 +62,13 @@ def notifications_main(v: User):
next_exists = (len(comments) > 25)
comments = comments[:25]
user_blocking = [row.target_id for row in g.db.query(UserBlock).filter_by(user_id=v.id)]
for c, n in comments:
c.notif_utc = n.created_utc
c.unread = not n.read
n.read = True
c.is_blocking = c.author_id in user_blocking
listing: list[Comment] = [c for c, _ in comments]