Merge pull request #3013 from evazion/fix-undelete-modaction

Log correct post id when approving deleted posts.
This commit is contained in:
Albert Yi
2017-05-02 11:51:17 -07:00
committed by GitHub
2 changed files with 5 additions and 7 deletions

View File

@@ -28,7 +28,7 @@ class PostApproval < ActiveRecord::Base
end
def approve_post
ModAction.log("undeleted post ##{id}") if post.is_deleted
ModAction.log("undeleted post ##{post_id}") if post.is_deleted
post.flags.each(&:resolve!)
post.update({ approver: user, is_flagged: false, is_pending: false, is_deleted: false }, without_protection: true)

View File

@@ -349,9 +349,8 @@ class PostTest < ActiveSupport::TestCase
end
should "create a mod action" do
assert_difference("ModAction.count", 1) do
@post.undelete!
end
@post.undelete!
assert_equal("undeleted post ##{@post.id}", ModAction.last.description)
end
end
@@ -362,9 +361,8 @@ class PostTest < ActiveSupport::TestCase
end
should "create a mod action" do
assert_difference("ModAction.count", 1) do
@post.approve!
end
@post.approve!
assert_equal("undeleted post ##{@post.id}", ModAction.last.description)
end
end