From 2300e9bd1e33a4f7c509830956fd5c0e41b8620f Mon Sep 17 00:00:00 2001 From: Toks Date: Sun, 17 Aug 2014 12:07:53 -0400 Subject: [PATCH] fixes #2244 --- app/models/forum_post.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/models/forum_post.rb b/app/models/forum_post.rb index 530544868..2ce4917c2 100644 --- a/app/models/forum_post.rb +++ b/app/models/forum_post.rb @@ -112,6 +112,7 @@ class ForumPost < ActiveRecord::Base if topic # need to do this to bypass the topic's original post from getting touched ForumTopic.where(:id => topic.id).update_all(["updater_id = ?, response_count = response_count + 1, updated_at = ?", CurrentUser.id, Time.now]) + topic.response_count += 1 end end @@ -135,8 +136,10 @@ class ForumPost < ActiveRecord::Base max = ForumPost.where(:topic_id => topic.id, :is_deleted => false).order("updated_at desc").first if max ForumTopic.where(:id => topic.id).update_all(["response_count = response_count - 1, updated_at = ?, updater_id = ?", max.updated_at, max.updater_id]) + topic.response_count -= 1 else ForumTopic.where(:id => topic.id).update_all("response_count = response_count - 1") + topic.response_count -= 1 end end