Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't include empty additional reasoning in cinder appeal decline emails if there isn't any #21938

Merged
merged 1 commit into from
Feb 27, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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