BURs: fix not being able to approve deprecation when tag is already deprecated.

Fix a bug where you couldn't approve a BUR deprecating a tag if that tag
was already deprecated by a separate BUR.
This commit is contained in:
evazion
2022-04-13 02:32:16 -05:00
parent 474ea5a6f0
commit e1c9a7d525

View File

@@ -131,7 +131,10 @@ class BulkUpdateRequestProcessor
when :deprecate
tag = Tag.find_by_name(args[0])
if tag.nil?
if validation_context == :approval
# ignore already deprecated tags and missing wikis when approving a tag deprecation.
elsif tag.nil?
errors.add(:base, "Can't deprecate #{args[0]} (tag doesn't exist)")
elsif tag.is_deprecated?
errors.add(:base, "Can't deprecate #{args[0]} (tag is already deprecated)")
@@ -141,7 +144,10 @@ class BulkUpdateRequestProcessor
when :undeprecate
tag = Tag.find_by_name(args[0])
if tag.nil?
if validation_context == :approval
# ignore already deprecated tags and missing wikis when removing a tag deprecation.
elsif tag.nil?
errors.add(:base, "Can't undeprecate #{args[0]} (tag doesn't exist)")
elsif !tag.is_deprecated?
errors.add(:base, "Can't undeprecate #{args[0]} (tag is not deprecated)")