post replacements: don't queue deletion when file is unchanged (#3235).

When replacing a post with the same file, don't queue a deletion and
don't leave a comment or modaction. There's no need to do these things
when we're restoring a missing or corrupted image with the original file.
This commit is contained in:
evazion
2017-07-27 16:26:35 -05:00
parent 9d4697d5cc
commit 76b4b365ae
2 changed files with 16 additions and 3 deletions

View File

@@ -261,6 +261,14 @@ class PostReplacementTest < ActiveSupport::TestCase
end
end
end
should "not queue a deletion or log a comment" do
upload_file("#{Rails.root}/test/files/test.jpg", "test.jpg") do |file|
assert_no_difference(["@post.comments.count", "ModAction.count"]) do
@post.replace!(replacement_file: file, replacement_url: "")
end
end
end
end
end
end