From 6dd4a746b68c050fee220909890d8e27d307a8f3 Mon Sep 17 00:00:00 2001 From: Mathieu Pillard Date: Tue, 17 Dec 2024 13:51:20 +0100 Subject: [PATCH] Allow reviewers to reply to blocked versions (#22952) --- src/olympia/reviewers/forms.py | 8 ++++---- src/olympia/reviewers/tests/test_forms.py | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/olympia/reviewers/forms.py b/src/olympia/reviewers/forms.py index c87d186663ab..72f1723b84f4 100644 --- a/src/olympia/reviewers/forms.py +++ b/src/olympia/reviewers/forms.py @@ -167,13 +167,13 @@ def create_option(self, *args, **kwargs): status = obj.file.status if obj.file else None # We annotate that needs_human_review property in review(). needs_human_review = getattr(obj, 'needs_human_review', False) - if status == amo.STATUS_DISABLED and obj.is_blocked: - # Override status for blocked versions: we don't want them - # unrejected. - status = None # Add our special `data-toggle` class and the right `data-value` # depending on what state the version is in. actions = self.actions_filters[obj.channel].get(status, []).copy() + if status == amo.STATUS_DISABLED and obj.is_blocked: + # We don't want blocked versions to get unrejected. Reply is + # fine though. + actions.remove('unreject_multiple_versions') if obj.pending_rejection: actions.append('clear_pending_rejection_multiple_versions') if needs_human_review: diff --git a/src/olympia/reviewers/tests/test_forms.py b/src/olympia/reviewers/tests/test_forms.py index 39942d93e802..8e2de92a84e7 100644 --- a/src/olympia/reviewers/tests/test_forms.py +++ b/src/olympia/reviewers/tests/test_forms.py @@ -742,10 +742,10 @@ def test_versions_queryset_contains_pending_files_for_listed( option4 = doc('option[value="%s"]' % blocked_version.pk)[0] assert option4.attrib.get('class') == 'data-toggle' - # That version is blocked, so unreject_multiple_versions is not - # present. It was never signed, so - # set_needs_human_review_multiple_versions is also absent. - assert option4.attrib.get('data-value') == '' + # That version is blocked, so the only action available is reply, + # unreject_multiple_versions and + # set_needs_human_review_multiple_versions should be absent. + assert option4.attrib.get('data-value') == 'reply' assert option4.attrib.get('value') == str(blocked_version.pk) def test_versions_queryset_contains_pending_files_for_listed_admin_reviewer(self): @@ -867,10 +867,10 @@ def test_versions_queryset_contains_pending_files_for_unlisted( option4 = doc('option[value="%s"]' % blocked_version.pk)[0] assert option4.attrib.get('class') == 'data-toggle' - # That version is blocked, so unreject_multiple_versions is not - # present. It was never signed, so - # set_needs_human_review_multiple_versions is also absent. - assert option4.attrib.get('data-value') == '' + # That version is blocked, so the only action available is reply, + # unreject_multiple_versions and + # set_needs_human_review_multiple_versions should be absent. + assert option4.attrib.get('data-value') == 'reply' assert option4.attrib.get('value') == str(blocked_version.pk) def test_set_needs_human_review_presence(self):