From e1c9a7d52500639e205ebc5eccae5c8eb6ee2e72 Mon Sep 17 00:00:00 2001 From: evazion Date: Wed, 13 Apr 2022 02:32:16 -0500 Subject: [PATCH] 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. --- app/logical/bulk_update_request_processor.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/logical/bulk_update_request_processor.rb b/app/logical/bulk_update_request_processor.rb index ad84d4e72..aec15aa61 100644 --- a/app/logical/bulk_update_request_processor.rb +++ b/app/logical/bulk_update_request_processor.rb @@ -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)")