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. 7
      tildes/tildes/models/comment/comment_tree.py

7
tildes/tildes/models/comment/comment_tree.py

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

Loading…
Cancel
Save