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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user