Skip to content

Commit

Permalink
reset file.status_disabled_reason when rejecting too (#22727)
Browse files Browse the repository at this point in the history
  • Loading branch information
eviljeff authored and KevinMind committed Oct 2, 2024
1 parent f1015a7 commit 4b92370
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/olympia/reviewers/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3675,14 +3675,17 @@ def test_resolve_appeal_job(self):
def test_reject_multiple_versions_resets_original_status_too(self):
old_version = self.review_version
old_version.file.update(
status=amo.STATUS_DISABLED, original_status=amo.STATUS_APPROVED
status=amo.STATUS_DISABLED,
original_status=amo.STATUS_APPROVED,
status_disabled_reason=File.STATUS_DISABLED_REASONS.DEVELOPER,
)
self.review_version = version_factory(
addon=self.addon,
version='3.0',
file_kw={
'status': amo.STATUS_DISABLED,
'original_status': amo.STATUS_AWAITING_REVIEW,
'status_disabled_reason': File.STATUS_DISABLED_REASONS.DEVELOPER,
},
)
self.file = self.review_version.file
Expand All @@ -3698,6 +3701,10 @@ def test_reject_multiple_versions_resets_original_status_too(self):
assert self.review_version.file.reload().status == amo.STATUS_DISABLED
assert old_version.file.original_status == amo.STATUS_NULL
assert self.review_version.file.original_status == amo.STATUS_NULL
assert old_version.file.original_status == File.STATUS_DISABLED_REASONS.NONE
assert self.review_version.file.original_status == (
File.STATUS_DISABLED_REASONS.NONE
)


@override_settings(ENABLE_ADDON_SIGNING=True)
Expand Down
2 changes: 2 additions & 0 deletions src/olympia/reviewers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from olympia.addons.models import Addon, AddonApprovalsCounter, AddonReviewerFlags
from olympia.constants.abuse import DECISION_ACTIONS
from olympia.constants.promoted import RECOMMENDED
from olympia.files.models import File
from olympia.lib.crypto.signing import sign_file
from olympia.reviewers.models import (
AutoApprovalSummary,
Expand Down Expand Up @@ -867,6 +868,7 @@ def set_file(self, status, file):
file.status = status
if status == amo.STATUS_DISABLED:
file.original_status = amo.STATUS_NULL
file.status_disabled_reason = File.STATUS_DISABLED_REASONS.NONE
file.save()

def set_promoted(self, versions=None):
Expand Down

0 comments on commit 4b92370

Please sign in to comment.