fixes #2133
This commit is contained in:
@@ -45,7 +45,7 @@ class Comment < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def search(params)
|
||||
q = scoped
|
||||
q = where("true")
|
||||
return q if params.blank?
|
||||
|
||||
if params[:body_matches].present?
|
||||
@@ -139,9 +139,9 @@ class Comment < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def update_last_commented_at_on_create
|
||||
Post.update_all(["last_commented_at = ?", created_at], ["id = ?", post_id])
|
||||
Post.where(:id => post_id).update_all(:last_commented_at => created_at)
|
||||
if Comment.where("post_id = ?", post_id).count <= Danbooru.config.comment_threshold && !do_not_bump_post?
|
||||
Post.update_all(["last_comment_bumped_at = ?", created_at], ["id = ?", post_id])
|
||||
Post.where(:id => post_id).update_all(:last_comment_bumped_at => created_at)
|
||||
end
|
||||
true
|
||||
end
|
||||
@@ -149,16 +149,16 @@ class Comment < ActiveRecord::Base
|
||||
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
|
||||
Post.update_all("last_commented_at = NULL", ["id = ?", post_id])
|
||||
Post.where(:id => post_id).update_all(:last_commented_at => nil)
|
||||
else
|
||||
Post.update_all(["last_commented_at = ?", other_comments.first.created_at], ["id = ?", post_id])
|
||||
Post.where(:id => post_id).update_all(:last_commented_at => other_comments.first.created_at)
|
||||
end
|
||||
|
||||
other_comments = other_comments.where("do_not_bump_post = FALSE")
|
||||
if other_comments.count == 0
|
||||
Post.update_all("last_comment_bumped_at = NULL", ["id = ?", post_id])
|
||||
Post.where(:id => post_id).update_all(:last_comment_bumped_at => nil)
|
||||
else
|
||||
Post.update_all(["last_comment_bumped_at = ?", other_comments.first.created_at], ["id = ?", post_id])
|
||||
Post.where(:id => post_id).update_all(:last_comment_bumped_at => other_comments.first.created_at)
|
||||
end
|
||||
|
||||
true
|
||||
|
||||
Reference in New Issue
Block a user