Fix #3417: Deleting a user's comment credits the change to them.
This commit is contained in:
@@ -182,8 +182,8 @@ class Comment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def initialize_updater
|
def initialize_updater
|
||||||
self.updater_id ||= CurrentUser.user.id
|
self.updater_id = CurrentUser.user.id
|
||||||
self.updater_ip_addr ||= CurrentUser.ip_addr
|
self.updater_ip_addr = CurrentUser.ip_addr
|
||||||
end
|
end
|
||||||
|
|
||||||
def creator_name
|
def creator_name
|
||||||
|
|||||||
@@ -244,6 +244,11 @@ class CommentTest < ActiveSupport::TestCase
|
|||||||
@comment.update_attributes({:body => "nope"}, :as => :moderator)
|
@comment.update_attributes({:body => "nope"}, :as => :moderator)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "credit the moderator as the updater" do
|
||||||
|
@comment.update({ body: "test" }, as: :moderator)
|
||||||
|
assert_equal(@mod.id, @comment.updater_id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "that is below the score threshold" do
|
context "that is below the score threshold" do
|
||||||
|
|||||||
Reference in New Issue
Block a user