Skip to content

Commit

Permalink
Don't include empty additional reasoning in cinder appeal decline ema…
Browse files Browse the repository at this point in the history
…ils if there isn't any (#21938)
  • Loading branch information
diox committed Feb 27, 2024
1 parent 38bc4dc commit 728c07f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Hello,

Previously, your {{ type }} was suspended/removed from Mozilla Add-ons, based on a finding that you had violated Mozilla's policies.

After reviewing your appeal, we determined that the previous decision, that your {{ type }} violates Mozilla's policies, was correct. {{ additional_reasoning }}. Based on that determination, we have denied your appeal, and will not reinstate your {{ type }}.
After reviewing your appeal, we determined that the previous decision, that your {{ type }} violates Mozilla's policies, was correct.{% if additional_reasoning %} {{ additional_reasoning }}.{% endif %} Based on that determination, we have denied your appeal, and will not reinstate your {{ type }}.

More information about Mozilla's add-on policies can be found at {{ policy_document_url }}.

Expand Down
27 changes: 25 additions & 2 deletions src/olympia/abuse/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,16 @@ def _test_owner_takedown_email(self, subject, snippet):
assert '"' not in mail_item.body
assert '<b>' not in mail_item.body

def _test_owner_affirmation_email(self, subject):
def _test_owner_affirmation_email(
self, subject, additional_reasoning='extra notes.'
):
mail_item = mail.outbox[0]
self._check_owner_email(mail_item, subject, 'was correct')
assert 'right to appeal' not in mail_item.body
assert 'extra notes.' in mail_item.body
if additional_reasoning:
assert additional_reasoning in mail_item.body
else:
assert ' was correct. Based on that determination' in mail_item.body

def _test_owner_restore_email(self, subject):
mail_item = mail.outbox[0]
Expand Down Expand Up @@ -472,6 +477,24 @@ def test_target_appeal_decline(self):
action.notify_owners()
self._test_owner_affirmation_email(f'Mozilla Add-ons: {self.addon.name}')

def test_target_appeal_decline_no_additional_reasoning(self):
self.addon.update(status=amo.STATUS_DISABLED)
ActivityLog.objects.all().delete()
self.cinder_job.update(decision_notes='')
action = CinderActionTargetAppealRemovalAffirmation(self.cinder_job)
assert action.process_action()

self.addon.reload()
assert self.addon.status == amo.STATUS_DISABLED
assert ActivityLog.objects.count() == 0
assert len(mail.outbox) == 0

action.notify_reporters()
action.notify_owners()
self._test_owner_affirmation_email(
f'Mozilla Add-ons: {self.addon.name}', additional_reasoning=None
)

def test_notify_owners_with_manual_policy_block(self):
self.cinder_job.update(
decision_action=CinderJob.DECISION_ACTIONS.AMO_DISABLE_ADDON
Expand Down

0 comments on commit 728c07f

Please sign in to comment.