From 58d101e75b419725e8cab6a76538d32b00f2c87a Mon Sep 17 00:00:00 2001 From: spez Date: Fri, 31 Jul 2009 13:56:55 -0700 Subject: [PATCH] fix a bug where adding a comment to a comment tree that isn't cached creates a broken comment page. --- r2/r2/lib/comment_tree.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/r2/r2/lib/comment_tree.py b/r2/r2/lib/comment_tree.py index a5dfa6fa8..27a5fa720 100644 --- a/r2/r2/lib/comment_tree.py +++ b/r2/r2/lib/comment_tree.py @@ -42,6 +42,11 @@ def add_comment_nolock(comment): cids, comment_tree, depth, num_children = link_comments(link_id) + #make sure we haven't already done this before (which would happen + #if the tree isn't cached when you add a comment) + if comment._id in cids: + return + #add to comment list cids.append(comment._id)