diff --git a/app/models/comment.rb b/app/models/comment.rb index e455e5cef..8418c41b8 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -14,8 +14,8 @@ class Comment < ActiveRecord::Base after_update(:if => lambda {|rec| CurrentUser.id != rec.creator_id}) do |rec| ModAction.log("comment ##{rec.id} updated by #{CurrentUser.name}") end - after_destroy :update_last_commented_at_on_destroy - after_destroy(:if => lambda {|rec| CurrentUser.id != rec.creator_id}) do |rec| + after_update :update_last_commented_at_on_destroy, :if => lambda {|rec| rec.is_deleted? && rec.is_deleted_changed?} + after_update(:if => lambda {|rec| rec.is_deleted? && rec.is_deleted_changed? && CurrentUser.id != rec.creator_id}) do |rec| ModAction.log("comment ##{rec.id} deleted by #{CurrentUser.name}") end attr_accessible :body, :post_id, :do_not_bump_post, :is_deleted, :as => [:member, :gold, :platinum, :builder, :janitor, :moderator, :admin] @@ -25,7 +25,7 @@ class Comment < ActiveRecord::Base :user_field => :creator_id, :title => "You were mentioned in a comment", :body => lambda {|rec, user_name| "You were mentioned in a \"comment\":/posts/#{rec.post_id}#comment-#{rec.id}\n\n---\n\n[i]#{rec.creator.name} said:[/i]\n\n#{ActionController::Base.helpers.excerpt(rec.body, user_name)}"} - ) + ) module SearchMethods def recent