uploads: merge tags when a duplicate is uploaded (fix #3130).
Automatically merge tags when uploading a duplicate. There are two cases: * You try to upload an image, but it's already on Danbooru. In this case you'll be immediately redirected to the original post, before you can start tagging the upload. * You're uploading an image, it wasn't a dupe when you first opened the upload page, but you got sniped while tagging it. In this case your tags will be merged with the original post, and you will be redirected to the original post. There are a few corner cases: * If you don't have permission to edit the original post, for example because it's banned or has a censored tag, then your tags won't be merged and will be silently ignored. * Only the tags, rating, and parent ID will be merged. The source and artist commentary won't be merged. This is so that if an artist uploads the exact same file to multiple sites, the new source won't override the original source. * Some tags might be contradictory. For example, the new post might be tagged translation_request, but the original post might already be translated. It's up to the user to fix these things afterwards.
This commit is contained in:
@@ -130,6 +130,14 @@ class UploadsControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
should "redirect a completed upload to the original post if it's a duplicate of an existing post" do
|
||||
@upload = create(:completed_file_upload, uploader: @user)
|
||||
@post = create(:post, md5: @upload.media_assets.first.md5, media_asset: @upload.media_assets.first)
|
||||
get_auth upload_path(@upload), @user
|
||||
|
||||
assert_redirected_to @post
|
||||
end
|
||||
end
|
||||
|
||||
context "create action" do
|
||||
|
||||
Reference in New Issue
Block a user