From 196dc680261ad9e7488d6aef73965d64709df7c3 Mon Sep 17 00:00:00 2001 From: Deimos Date: Wed, 3 Oct 2018 19:20:13 -0600 Subject: [PATCH] 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. --- tildes/tildes/models/comment/comment_tree.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tildes/tildes/models/comment/comment_tree.py b/tildes/tildes/models/comment/comment_tree.py index 5af0930..f9ca3f6 100644 --- a/tildes/tildes/models/comment/comment_tree.py +++ b/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: