[Replacements] Automatically remove bvas on approve

Closes #377
This commit is contained in:
Earlopain 2022-02-19 18:45:35 +01:00
parent 8007881660
commit 86dc0c80e9
No known key found for this signature in database
GPG Key ID: 6CFB948E15246897
2 changed files with 11 additions and 13 deletions

View File

@ -43,15 +43,15 @@ class UploadService
replacement.replacement_file = Danbooru.config.storage_manager.open(Danbooru.config.storage_manager.replacement_path(replacement, replacement.file_ext, :original))
upload = Upload.create(
uploader_id: CurrentUser.id,
uploader_ip_addr: CurrentUser.ip_addr,
rating: post.rating,
tag_string: post.tag_string,
source: replacement.source,
file: replacement.replacement_file,
replaced_post: post,
original_post_id: post.id,
replacement_id: replacement.id
uploader_id: CurrentUser.id,
uploader_ip_addr: CurrentUser.ip_addr,
rating: post.rating,
tag_string: (post.tag_array - Danbooru.config.tags_to_remove_after_replacement_accepted).join(" "),
source: replacement.source,
file: replacement.replacement_file,
replaced_post: post,
original_post_id: post.id,
replacement_id: replacement.id
)
begin
@ -90,7 +90,6 @@ class UploadService
post.uploader_ip_addr = replacement.creator_ip_addr
post.save!
# rescaling notes reloads the post, be careful when accessing previous values
rescale_notes(post)
update_ugoira_frame_data(post, upload)

View File

@ -763,9 +763,8 @@ fart'
true
end
# Should return true if the given tag should be suggested for removal in the post replacement dialog box.
def remove_tag_after_replacement?(tag)
tag =~ /\A(?:replaceme|.*_sample|resized|upscaled|downscaled|md5_mismatch|jpeg_artifacts|corrupted_image|source_request)\z/i
def tags_to_remove_after_replacement_accepted
["better_version_at_source"]
end
# Posts with these tags will be highlighted yellow in the modqueue.