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

Attachment Emails for Reviewer Attachments #22704

Merged
merged 8 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
5 changes: 5 additions & 0 deletions src/olympia/abuse/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from olympia import amo
from olympia.addons.models import Addon
from olympia.amo.models import BaseQuerySet, ManagerBase, ModelBase
from olympia.amo.templatetags.jinja_helpers import absolutify
from olympia.api.utils import APIChoicesWithNone
from olympia.bandwagon.models import Collection
from olympia.constants.abuse import (
Expand Down Expand Up @@ -1241,6 +1242,10 @@ def notify_reviewer_decision(
# tools, we don't want to duplicate it as policies too.
'policies': policies if not self.notes else (),
'version_list': ', '.join(ver_str for ver_str in version_numbers),
'has_attachment': hasattr(log_entry, 'attachmentlog'),
'dev_url': absolutify(self.target.get_dev_url('versions'))
if self.addon_id
else None,
},
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Your add-on can be subject to human review at any time. Reviewers may determine
{% endif %}
{% if manual_reasoning_text %}Comments: {{ manual_reasoning_text }}.{% endif %}

{% if has_attachment %}
An attachment was provided. {% if dev_url %}To respond or view the file, visit {{ dev_url }}.{% endif %}

{% endif %}
Thank you.

More information about Mozilla's add-on policies can be found at {{ policy_document_url }}.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{% extends "abuse/emails/base.txt" %}{% block content %}
Your {{ type }} {{ name }} was manually reviewed by the Mozilla Add-ons team {% if is_third_party_initiated %}based on a report we received from a third party{% else %}in an assessment performed on our own initiative of content that was submitted to Mozilla Add-ons{% endif %}.

{% if has_attachment %}
An attachment was provided. {% if dev_url %}To respond or view the file, visit {{ dev_url }}.{% endif %}

{% endif %}
chrstinalin marked this conversation as resolved.
Show resolved Hide resolved
Our review found that your content violates the following Mozilla policy or policies:
{% include 'abuse/emails/includes/policies.txt' %}

Based on that finding, your {{ type }} has been permanently disabled on {{ target_url }} and is no longer available for download from Mozilla Add-ons, anywhere in the world. {% if is_addon_being_blocked %}In addition, users who have previously installed the add-on won't be able to continue using it.{% else %}Users who have previously installed your add-on will be able to continue using it.{% endif %}
{% endblock %}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{% extends "abuse/emails/base.txt" %}{% block content %}
Your {{ type }} {{ name }} was manually reviewed by the Mozilla Add-ons team {% if is_third_party_initiated %}based on a report we received from a third party{% else %}in an assessment performed on our own initiative of content that was submitted to Mozilla Add-ons{% endif %}.

{% if has_attachment %}
An attachment was provided. {% if dev_url %}To respond or view the file, visit {{ dev_url }}.{% endif %}

{% endif %}
Our review found that your content violates the following Mozilla policy or policies:
{% include 'abuse/emails/includes/policies.txt' %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{% extends "abuse/emails/base.txt" %}{% block content %}
Your {{ type }} {{ name }} was manually reviewed by the Mozilla Add-ons team {% if is_third_party_initiated %}based on a report we received from a third party{% else %}in an assessment performed on our own initiative of content that was submitted to Mozilla Add-ons{% endif %}.

{% if has_attachment %}
An attachment was provided. {% if dev_url %}To respond or view the file, visit {{ dev_url }}.{% endif %}

{% endif %}
Our review found that your content violates the following Mozilla policy or policies:
{% include 'abuse/emails/includes/policies.txt' %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Previously, your {{ type }} was suspended/removed from Mozilla Add-ons, based on
{% if not is_override %}After reviewing your appeal, we{% else %}We have now{% endif %} determined that the previous decision was incorrect, and based on that determination, we have restored your {{ type }}. It is now available at {{ target_url }}.
{% if manual_reasoning_text %}{{ manual_reasoning_text }}. {% endif %}

{% if has_attachment %}
An attachment was provided. {% if dev_url %}To respond or view the file, visit {{ dev_url }}.{% endif %}

{% endif %}
Thank you.

More information about Mozilla's add-on policies can be found at {{ policy_document_url }}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ Hello,

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

{% if has_attachment %}
An attachment was provided. {% if dev_url %}To respond or view the file, visit {{ dev_url }}.{% endif %}

{% endif %}
chrstinalin marked this conversation as resolved.
Show resolved Hide resolved
After reviewing your appeal, we determined that the previous decision, that your {{ type }} violates Mozilla's policies, was correct. {% if manual_reasoning_text %}{{ manual_reasoning_text }}. {% 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
15 changes: 14 additions & 1 deletion src/olympia/abuse/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
from django.conf import settings
from django.core import mail
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.core.files.base import ContentFile
from django.db.utils import IntegrityError

import pytest
import responses
from waffle.testutils import override_switch

from olympia import amo
from olympia.activity.models import ActivityLog
from olympia.activity.models import ActivityLog, AttachmentLog
from olympia.addons.models import Addon
from olympia.amo.tests import (
TestCase,
Expand Down Expand Up @@ -2746,6 +2747,18 @@ def _test_notify_reviewer_decision(
assert 'days' not in mail.outbox[0].body
assert 'some review text' in mail.outbox[0].body
assert 'some policy text' not in mail.outbox[0].body
AttachmentLog.objects.create(
activity_log=log_entry,
file=ContentFile('Pseudo File', name='attachment.txt'),
)
eviljeff marked this conversation as resolved.
Show resolved Hide resolved
decision.notify_reviewer_decision(
log_entry=log_entry,
entity_helper=entity_helper,
)
assert 'An attachment was provided.' not in mail.outbox[0].body
assert 'To respond or view the file,' not in mail.outbox[0].body
assert 'An attachment was provided.' in mail.outbox[1].body
assert 'To respond or view the file,' in mail.outbox[1].body
else:
assert len(mail.outbox) == 0

Expand Down
Loading