From f4666fe493c0506745872dc1e546f1102f460c35 Mon Sep 17 00:00:00 2001 From: Mathieu Agopian Date: Fri, 9 Jan 2015 12:14:00 +0100 Subject: [PATCH] Addon owner notification emails are only text (bug 712682) --- apps/amo/mail.py | 2 +- apps/amo/tests/test_send_mail.py | 2 +- apps/devhub/views.py | 3 ++- apps/users/templates/users/email/author_added.ltxt | 4 ++-- apps/users/templates/users/email/author_changed.ltxt | 4 ++-- apps/users/templates/users/email/author_removed.ltxt | 5 ++--- settings.py | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/apps/amo/mail.py b/apps/amo/mail.py index 7bc6adb6b8..e4e26c647d 100644 --- a/apps/amo/mail.py +++ b/apps/amo/mail.py @@ -39,7 +39,7 @@ class DevEmailBackend(BaseEmailBackend): # We don't want to send real emails to people if # they happen to also be in the recipients together # with white-listed emails - msg.to = qa_emails + msg.to = list(qa_emails) qa_messages.append(msg) if qa_messages: log.debug('Sending real mail messages to QA.') diff --git a/apps/amo/tests/test_send_mail.py b/apps/amo/tests/test_send_mail.py index 8887142e84..aa374fca6f 100644 --- a/apps/amo/tests/test_send_mail.py +++ b/apps/amo/tests/test_send_mail.py @@ -171,7 +171,7 @@ class TestSendMail(BaseTestCase): recipient_list=['nobody@mozilla.org', 'b@example.fr'], fail_silently=False) eq_(len(mail.outbox), 1) - eq_(mail.outbox[0].to, set(['nobody@mozilla.org'])) + eq_(mail.outbox[0].to, ['nobody@mozilla.org']) eq_(FakeEmail.objects.count(), 1) @mock.patch('amo.utils.Context') diff --git a/apps/devhub/views.py b/apps/devhub/views.py index 6a88f8668a..7344fc6924 100644 --- a/apps/devhub/views.py +++ b/apps/devhub/views.py @@ -412,7 +412,8 @@ def ownership(request, addon_id, addon): t = loader.get_template( 'users/email/{part}.ltxt'.format(part=template_part)) send_mail(title, - t.render(Context({'author': author, 'addon': addon})), + t.render(Context({'author': author, 'addon': addon, + 'site_url': settings.SITE_URL})), None, recipients, use_blacklist=False, real_email=True) if request.method == 'POST' and all([form.is_valid() for form in fs]): diff --git a/apps/users/templates/users/email/author_added.ltxt b/apps/users/templates/users/email/author_added.ltxt index 35b3988ed4..976fed370e 100644 --- a/apps/users/templates/users/email/author_added.ltxt +++ b/apps/users/templates/users/email/author_added.ltxt @@ -1,5 +1,5 @@ {% load i18n %}{# L10n: This is an email. Whitespace matters! #}{% blocktrans with addon_url=addon.get_absolute_url addon_name=addon.name author_url=author.user.get_absolute_url author_name=author.user.name author_role=author.get_role_display %} -The following author has been added to your addon {{ addon_name }}: +The following author has been added to your addon {{ addon_name }} ({{ site_url }}{{ addon_url }}): -{{ author_name }}: {{ author_role }} +{{ author_name }} ({{ site_url }}{{ author_url }}): {{ author_role }} {% endblocktrans %} diff --git a/apps/users/templates/users/email/author_changed.ltxt b/apps/users/templates/users/email/author_changed.ltxt index 0af593c058..f4fb5a7d4f 100644 --- a/apps/users/templates/users/email/author_changed.ltxt +++ b/apps/users/templates/users/email/author_changed.ltxt @@ -1,5 +1,5 @@ {% load i18n %}{# L10n: This is an email. Whitespace matters! #}{% blocktrans with addon_url=addon.get_absolute_url addon_name=addon.name author_url=author.user.get_absolute_url author_name=author.user.name author_role=author.get_role_display %} -The following author has been changed on your addon {{ addon_name }}: +The following author has been changed on your addon {{ addon_name }} ({{ site_url }}{{ addon_url }}): -{{ author_name }}: {{ author_role }} +{{ author_name }} ({{ site_url }}{{ author_url }}): {{ author_role }} {% endblocktrans %} diff --git a/apps/users/templates/users/email/author_removed.ltxt b/apps/users/templates/users/email/author_removed.ltxt index b5bf34175b..32a37644ba 100644 --- a/apps/users/templates/users/email/author_removed.ltxt +++ b/apps/users/templates/users/email/author_removed.ltxt @@ -1,6 +1,5 @@ {% load i18n %}{# L10n: This is an email. Whitespace matters! #}{% blocktrans with addon_url=addon.get_absolute_url addon_name=addon.name author_url=author.user.get_absolute_url author_name=author.user.name %} -The following author has been removed from addon {{ addon_name }}: +The following author has been removed from addon {{ addon_name }} ({{ site_url }}{{ addon_url }}): -{{ author_name }} +{{ author_name }} ({{ site_url }}{{ author_url }}) {% endblocktrans %} - diff --git a/settings.py b/settings.py index 71363223a0..2825753600 100644 --- a/settings.py +++ b/settings.py @@ -66,7 +66,7 @@ UGLIFY_BIN = path('node_modules/uglify-js/bin/uglifyjs') # replicas to zero. ES_DEFAULT_NUM_REPLICAS = 0 -SITE_URL = 'http://localhost:8000/' +SITE_URL = 'http://localhost:8000' SERVICES_DOMAIN = 'localhost:8000' SERVICES_URL = 'http://%s' % SERVICES_DOMAIN