fixes #1190
This commit is contained in:
@@ -7,7 +7,7 @@ class Comment < ActiveRecord::Base
|
|||||||
has_many :votes, :class_name => "CommentVote", :dependent => :destroy
|
has_many :votes, :class_name => "CommentVote", :dependent => :destroy
|
||||||
before_validation :initialize_creator, :on => :create
|
before_validation :initialize_creator, :on => :create
|
||||||
before_validation :initialize_updater
|
before_validation :initialize_updater
|
||||||
after_save :update_last_commented_at_on_save
|
after_create :update_last_commented_at_on_create
|
||||||
after_destroy :update_last_commented_at_on_destroy
|
after_destroy :update_last_commented_at_on_destroy
|
||||||
attr_accessible :body, :post_id, :do_not_bump_post
|
attr_accessible :body, :post_id, :do_not_bump_post
|
||||||
attr_accessor :do_not_bump_post
|
attr_accessor :do_not_bump_post
|
||||||
@@ -108,7 +108,7 @@ class Comment < ActiveRecord::Base
|
|||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_last_commented_at_on_save
|
def update_last_commented_at_on_create
|
||||||
if Comment.where("post_id = ?", post_id).count <= Danbooru.config.comment_threshold && !do_not_bump_post?
|
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])
|
Post.update_all(["last_commented_at = ?", created_at], ["id = ?", post_id])
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user