Browse Source

Fix bug in uncollapsing behavior for new comments

Uncollapsing the new comments' parents wasn't working correctly if there
were several new replies in a chain. Because it's working from the
"leaf" comments back up towards the root, doing a continue when a
comment's state had already been set would cause uncollapsing parents to
fail - the deepest comment would uncollapse its parent, then its parent
would get skipped. If the parent was also new, this would mean that
*its* parent didn't get uncollapsed, even though it should have been.
merge-requests/40/head
Deimos 6 years ago
parent
commit
196dc68026
  1. 9
      tildes/tildes/models/comment/comment_tree.py

9
tildes/tildes/models/comment/comment_tree.py

@ -192,16 +192,13 @@ class CommentTree:
if comment.is_deleted or comment.is_removed:
continue
# don't override any other collapsing decisions
if comment.collapsed_state:
continue
# don't apply to the viewer's own comments
if comment.user == self.viewer:
continue
# uncollapse the comment
comment.collapsed_state = "uncollapsed"
# uncollapse the comment (as long as it hasn't already had its state set)
if not comment.collapsed_state:
comment.collapsed_state = "uncollapsed"
# fetch its direct parent and uncollapse it as well
if comment.parent_comment_id:

Loading…
Cancel
Save