Fix #4933: Don't allow mass update requests if both the antecedent and consequent are single tags

This commit is contained in:
evazion
2021-12-09 18:02:19 -06:00
parent 00153b9214
commit 7dbde7bc14
3 changed files with 21 additions and 11 deletions

View File

@@ -113,7 +113,15 @@ class BulkUpdateRequestProcessor
errors.add(:base, "Can't rename #{args[0]} -> #{args[1]} ('#{args[0]}' has more than #{MAXIMUM_RENAME_COUNT} posts, use an alias instead)")
end
when :mass_update, :nuke
when :mass_update
lhs = PostQueryBuilder.new(args[0])
rhs = PostQueryBuilder.new(args[1])
if lhs.is_simple_tag? && rhs.is_simple_tag?
errors.add(:base, "Can't mass update #{args[0]} -> #{args[1]} (use an alias or a rename instead for tag moves)")
end
when :nuke
# okay
when :invalid_line
@@ -210,11 +218,6 @@ class BulkUpdateRequestProcessor
case command
when :create_alias, :rename
BulkUpdateRequestProcessor.is_tag_move_allowed?(args[0], args[1])
when :mass_update
lhs = PostQueryBuilder.new(args[0])
rhs = PostQueryBuilder.new(args[1])
lhs.is_simple_tag? && rhs.is_simple_tag? && BulkUpdateRequestProcessor.is_tag_move_allowed?(args[0], args[1])
else
false
end