diff --git a/app/models/comment.rb b/app/models/comment.rb index 213907387..a2973cf22 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -101,6 +101,13 @@ class Comment < ActiveRecord::Base end end + def update_last_commented_at_on_create + if Comment.where("post_id = ?", post_id).count <= Danbooru.config.comment_threshold && !do_not_bump_post? + Post.update_all(["last_commented_at = ?", created_at], ["id = ?", post_id]) + end + true + end + def update_last_commented_at_on_destroy other_comments = Comment.where("post_id = ? and id <> ?", post_id, id).order("id DESC") if other_comments.count == 0 @@ -111,13 +118,6 @@ class Comment < ActiveRecord::Base true end - def update_last_commented_at_on_create - if Comment.where("post_id = ?", post_id).count <= Danbooru.config.comment_threshold && !do_not_bump_post? - Post.update_all(["last_commented_at = ?", created_at], ["id = ?", post_id]) - end - true - end - def do_not_bump_post? do_not_bump_post == "1" end