Fix improper calls to Comment.replies.

In four contexts, Comment.replies(.) was not updated to reflect the
interface changes with comment filtering. This directly caused #170
and #172 (which was a stack trace from the former).
  - Updating notifications for DMs (routes/users.py L690)
  - Updating notifications for modmail (routes/users.py L729)
  - morecomments for logged out users (routes/posts.py L421)
  - JSON for API access (classes/comment.py L347)

All four contexts seem to behave correctly after the change. However,
strictly speaking the JSON generation will not include a user's own
filtered or removed comments, though this is hard to remedy without
passing the user object `v` to json_core. Propagating that through the
codebase seems a worse option than leaving it as is.
This commit is contained in:
TLSM 2022-08-17 02:49:19 -04:00 committed by Ben Rog-Wilhelm
parent d4dd495b31
commit 965a4dc157
3 changed files with 4 additions and 5 deletions

View file

@ -418,7 +418,7 @@ def morecomments(v, cid):
comments = output
else:
c = g.db.query(Comment).filter_by(id=cid).one_or_none()
comments = c.replies
comments = c.replies(None)
if comments: p = comments[0].post
else: p = None