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

@ -344,8 +344,7 @@ class Comment(Base):
if self.level>=2: data['parent_comment_id']= self.parent_comment_id
if "replies" in self.__dict__:
data['replies']=[x.json_core for x in self.replies]
data['replies']=[x.json_core for x in self.replies(None)]
return data