From 111b9de2ef5e5d5edaf665f5f200e0b3fc7293a0 Mon Sep 17 00:00:00 2001 From: Deimos Date: Fri, 14 Sep 2018 15:08:30 -0600 Subject: [PATCH] Use weight instead of count for collapsing noise --- tildes/tildes/models/comment/comment_tree.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tildes/tildes/models/comment/comment_tree.py b/tildes/tildes/models/comment/comment_tree.py index 1b12951..849b4bc 100644 --- a/tildes/tildes/models/comment/comment_tree.py +++ b/tildes/tildes/models/comment/comment_tree.py @@ -177,7 +177,11 @@ class CommentTree: if comment.user == self.viewer: continue - if comment.tag_counts["noise"] >= 2: + # Collapse a comment if it has weight from noise tags of at least + # 1.0 and the vote count is less than 5x the weight (so 5 votes are + # "stronger" than each 1.0 of noise and will prevent collapsing) + noise_weight = comment.tag_weights["noise"] + if noise_weight >= 1.0 and comment.num_votes < noise_weight * 5: comment.collapsed_state = "full" def uncollapse_new_comments(self, threshold: datetime) -> None: