fix comment bumping

This commit is contained in:
albert
2013-02-24 17:54:42 -05:00
parent c0c130395b
commit 4cbef26c05
2 changed files with 16 additions and 3 deletions

View File

@@ -84,10 +84,10 @@ class Comment < ActiveRecord::Base
end
def update_last_commented_at
if Comment.where("post_id = ?", post_id).count <= Danbooru.config.comment_threshold && !do_not_bump_post
execute_sql("UPDATE posts SET last_commented_at = ? WHERE id = ?", created_at, post_id)
elsif Comment.where("post_id = ?", post_id).empty?
if Comment.where("post_id = ?", post_id).empty?
execute_sql("UPDATE posts SET last_commented_at = null WHERE id = ?", post_id)
elsif Comment.where("post_id = ?", post_id).count <= Danbooru.config.comment_threshold && !do_not_bump_post
execute_sql("UPDATE posts SET last_commented_at = ? WHERE id = ?", created_at, post_id)
end
end