config: refactor remove_tag_after_replacement? config option.
This commit is contained in:
@@ -29,7 +29,12 @@ class PostReplacement < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def suggested_tags_for_removal
|
def suggested_tags_for_removal
|
||||||
tags = post.tag_array.select { |tag| Danbooru.config.remove_tag_after_replacement?(tag) }
|
tags = post.tag_array.select do |tag|
|
||||||
|
Danbooru.config.post_replacement_tag_removals.any? do |pattern|
|
||||||
|
tag.match?(/\A#{pattern}\z/i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
tags = tags.map { |tag| "-#{tag}" }
|
tags = tags.map { |tag| "-#{tag}" }
|
||||||
tags.join(" ")
|
tags.join(" ")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -321,9 +321,10 @@ module Danbooru
|
|||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# Should return true if the given tag should be suggested for removal in the post replacement dialog box.
|
# A list of tags that should be removed when a post is replaced. Regexes allowed.
|
||||||
def remove_tag_after_replacement?(tag)
|
def post_replacement_tag_removals
|
||||||
tag =~ /\A(?:replaceme|.*_sample|resized|upscaled|downscaled|md5_mismatch|jpeg_artifacts|corrupted_image|source_request|non-web_source)\z/i
|
%w[replaceme .*_sample resized upscaled downscaled md5_mismatch
|
||||||
|
jpeg_artifacts corrupted_image source_request non-web_source]
|
||||||
end
|
end
|
||||||
|
|
||||||
# Posts with these tags will be highlighted in the modqueue.
|
# Posts with these tags will be highlighted in the modqueue.
|
||||||
|
|||||||
Reference in New Issue
Block a user