swap method location for neatness
This commit is contained in:
@@ -101,6 +101,13 @@ class Comment < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
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
|
def update_last_commented_at_on_destroy
|
||||||
other_comments = Comment.where("post_id = ? and id <> ?", post_id, id).order("id DESC")
|
other_comments = Comment.where("post_id = ? and id <> ?", post_id, id).order("id DESC")
|
||||||
if other_comments.count == 0
|
if other_comments.count == 0
|
||||||
@@ -111,13 +118,6 @@ class Comment < ActiveRecord::Base
|
|||||||
true
|
true
|
||||||
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 do_not_bump_post?
|
def do_not_bump_post?
|
||||||
do_not_bump_post == "1"
|
do_not_bump_post == "1"
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user