Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/olympia/abuse/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -995,10 +995,23 @@ class ContentActionApproveInitialDecision(


class ContentActionTargetAppealRemovalAffirmation(
AnyTargetMixin, NoActionMixin, AnyOwnerEmailMixin, ContentAction
AnyTargetMixin, AnyOwnerEmailMixin, ContentAction
):
description = 'Reported content is still offending, after appeal.'

def process_action(self, release_hold=False):
previous_decision_actions = (
self.decision.cinder_job.appealed_decisions.values_list('action', flat=True)
)
Comment on lines +1003 to +1005
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know I could optimize this query to be an exists, as we're only interested in one case. I just kept it the same as we do in ContentActionTargetAppealApprove so it's understandable as the same concept. But I can rewrite if you prefer? (as with the unnecessary return None at the end of the function)

if (
isinstance(self.target, Addon)
and DECISION_ACTIONS.AMO_REJECT_LISTING_CONTENT in previous_decision_actions
and self.target.status == amo.STATUS_REJECTED
):
AddonApprovalsCounter.reject_content_for_addon(self.target)

return None


class ContentActionIgnore(AnyTargetMixin, NoActionMixin, ContentAction):
description = 'Report is invalid, so no action'
Expand Down
23 changes: 23 additions & 0 deletions src/olympia/abuse/tests/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2397,6 +2397,29 @@ def test_already_taken_down(self):
# a new review, and we reject it again
self._process_action_and_notify()

def test_target_appeal_decline(self):
self.addon.update(status=amo.STATUS_REJECTED)
AddonApprovalsCounter.objects.create(
addon=self.addon,
content_review_status=AddonApprovalsCounter.CONTENT_REVIEW_STATUSES.REQUESTED,
)
self.past_negative_decision.update(appeal_job=self.cinder_job)
ActivityLog.objects.all().delete()
action = ContentActionTargetAppealRemovalAffirmation(self.decision)
assert action.process_action() is None

self.addon.reload()
assert self.addon.status == amo.STATUS_REJECTED
assert self.addon.addonapprovalscounter.reload().content_review_status == (
AddonApprovalsCounter.CONTENT_REVIEW_STATUSES.FAIL
)
assert ActivityLog.objects.count() == 0
assert len(mail.outbox) == 0

self.cinder_job.notify_reporters(action)
action.notify_owners()
self._test_owner_affirmation_email(f'Mozilla Add-ons: {self.addon.name}')


class TestContentActionCollection(BaseTestContentAction, TestCase):
ActionClass = ContentActionDeleteCollection
Expand Down
Loading