diff --git a/r2/r2/lib/comment_tree.py b/r2/r2/lib/comment_tree.py index d7fb5af15..dc5523a0a 100644 --- a/r2/r2/lib/comment_tree.py +++ b/r2/r2/lib/comment_tree.py @@ -128,12 +128,6 @@ def add_comments_nolock(link_id, comments): r[cm_id] = None # print "And I set %s -> None" % cm_id - # update the link's comment count and schedule it for search reindexing - link = Link._byID(link_id, data = True) - link._incr('num_comments', len(comments)) - from r2.lib.db.queries import changed - changed(link) - g.permacache.set(key, r) g.permacache.set(comments_key(link_id), diff --git a/r2/r2/models/link.py b/r2/r2/models/link.py index fae465780..80064e288 100755 --- a/r2/r2/models/link.py +++ b/r2/r2/models/link.py @@ -604,6 +604,8 @@ class Comment(Thing, Printable): if parent: c.parent_id = parent._id + link._incr('num_comments', 1) + to = None name = 'inbox' if parent: @@ -614,6 +616,8 @@ class Comment(Thing, Printable): c._commit() + changed(link, True) # link's number of comments changed + inbox_rel = None # only global admins can be message spammed. if to and (not c._spam or to.name in g.admins):