From fd61e80f5b16f28e161c2edf36761492f93f5145 Mon Sep 17 00:00:00 2001 From: Neil Williams Date: Tue, 25 Feb 2014 11:46:20 -0800 Subject: [PATCH] Ensure comments get queued for processing even if rendering fails. This is a hacky fix for comments failing to render causing incorrect comment counts. --- r2/r2/controllers/api.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index da1a260c6..636d8f9aa 100755 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -1454,6 +1454,17 @@ class ApiController(RedditController): # newcomments_q, so if they refresh immediately they # won't see their comment + #update the queries + if is_message: + queries.new_message(item, inbox_rel) + else: + queries.new_comment(item, inbox_rel) + + #set the ratelimiter + if should_ratelimit: + VRatelimit.ratelimit(rate_user=True, rate_ip = True, + prefix = "rate_comment_") + # clean up the submission form and remove it from the DOM (if reply) t = commentform.find("textarea") t.attr('rows', 3).html("").val("") @@ -1468,17 +1479,6 @@ class ApiController(RedditController): # remove any null listings that may be present jquery("#noresults").hide() - #update the queries - if is_message: - queries.new_message(item, inbox_rel) - else: - queries.new_comment(item, inbox_rel) - - #set the ratelimiter - if should_ratelimit: - VRatelimit.ratelimit(rate_user=True, rate_ip = True, - prefix = "rate_comment_") - @validatedForm(VUser(), VModhash(), VCaptcha(),