Merge pull request #1071 from migonzalvar/TG-5334

Add unsubscribe link to every notification email
remotes/origin/release/3.1.1
Alejandro 2018-02-13 08:56:38 +01:00 committed by GitHub
commit 880289b0a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 5 deletions

View File

@ -435,7 +435,10 @@
<tr> <tr>
<td valign="top" class="footerContent"> <td valign="top" class="footerContent">
{% block footer %} {% block footer %}
{% trans support_url=sr("support.url"), support_email=sr("support.email"), mailing_list_url=sr("support.mailing_list") %} {% trans unsubscribe_url=resolve_front_url("settings-mail-notifications"), support_url=sr("support.url"), support_email=sr("support.email"), mailing_list_url=sr("support.mailing_list") %}
<strong>Configure email notifications or unsubscribe:</strong>
<a href="{{ unsubscribe_url }}" title="Unsubscribe" style="color: #9dce0a">{{ unsubscribe_url}}</a>
<br>
<strong>Taiga Support:</strong> <strong>Taiga Support:</strong>
<a href="{{ support_url }}" title="Support page" style="color: #9dce0a">{{ support_url}}</a> <a href="{{ support_url }}" title="Support page" style="color: #9dce0a">{{ support_url}}</a>
<br> <br>

View File

@ -394,7 +394,10 @@
<tr> <tr>
<td valign="top" class="footerContent"> <td valign="top" class="footerContent">
{% block footer %} {% block footer %}
{% trans support_url=sr("support.url"), support_email=sr("support.email"), mailing_list_url=sr("support.mailing_list") %} {% trans unsubscribe_url=resolve_front_url("settings-mail-notifications"), support_url=sr("support.url"), support_email=sr("support.email"), mailing_list_url=sr("support.mailing_list") %}
<strong>Configure email notifications or unsubscribe:</strong>
<a href="{{ unsubscribe_url }}" title="Unsubscribe" style="color: #9dce0a">{{ unsubscribe_url}}</a>
<br>
<strong>Taiga Support:</strong> <strong>Taiga Support:</strong>
<a href="{{ support_url }}" title="Support page" style="color: #9dce0a">{{ support_url}}</a> <a href="{{ support_url }}" title="Support page" style="color: #9dce0a">{{ support_url}}</a>
<br> <br>

View File

@ -456,7 +456,10 @@
<tr> <tr>
<td valign="top" class="footerContent"> <td valign="top" class="footerContent">
{% block footer %} {% block footer %}
{% trans support_url=sr("support.url"), support_email=sr("support.email"), mailing_list_url=sr("support.mailing_list") %} {% trans unsubscribe_url=resolve_front_url("settings-mail-notifications"), support_url=sr("support.url"), support_email=sr("support.email"), mailing_list_url=sr("support.mailing_list") %}
<strong>Configure email notifications or unsubscribe:</strong>
<a href="{{ unsubscribe_url }}" title="Unsubscribe" style="color: #9dce0a">{{ unsubscribe_url}}</a>
<br>
<strong>Taiga Support:</strong> <strong>Taiga Support:</strong>
<a href="{{ support_url }}" title="Support page" style="color: #9dce0a">{{ support_url}}</a> <a href="{{ support_url }}" title="Support page" style="color: #9dce0a">{{ support_url}}</a>
<br> <br>

View File

@ -25,6 +25,7 @@ urls = {
"forgot-password": "/forgot-password", "forgot-password": "/forgot-password",
"new-project": "/project/new", "new-project": "/project/new",
"new-project-import": "/project/new/import/{0}", "new-project-import": "/project/new/import/{0}",
"settings-mail-notifications": "/user-settings/mail-notifications",
"change-password": "/change-password/{0}", # user.token "change-password": "/change-password/{0}", # user.token
"change-email": "/change-email/{0}", # user.email_token "change-email": "/change-email/{0}", # user.email_token

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: taiga-back\n" "Project-Id-Version: taiga-back\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-06 11:42+0200\n" "POT-Creation-Date: 2018-02-08 12:00+0100\n"
"PO-Revision-Date: 2015-03-25 20:09+0100\n" "PO-Revision-Date: 2015-03-25 20:09+0100\n"
"Last-Translator: Taiga Dev Team <support@taiga.io>\n" "Last-Translator: Taiga Dev Team <support@taiga.io>\n"
"Language-Team: Taiga Dev Team <support@taiga.io>\n" "Language-Team: Taiga Dev Team <support@taiga.io>\n"
@ -396,6 +396,12 @@ msgstr ""
#, python-format #, python-format
msgid "" msgid ""
"\n" "\n"
" <strong>Configure email "
"notifications or unsubscribe:</strong>\n"
" <a href="
"\"%(unsubscribe_url)s\" title=\"Unsubscribe\" style=\"color: #9dce0a\">"
"%(unsubscribe_url)s</a>\n"
" <br>\n"
" <strong>Taiga Support:</" " <strong>Taiga Support:</"
"strong>\n" "strong>\n"
" <a href=\"%(support_url)s" " <a href=\"%(support_url)s"

View File

@ -31,6 +31,7 @@ from django.utils.translation import ugettext as _
from taiga.base import exceptions as exc from taiga.base import exceptions as exc
from taiga.base.mails import InlineCSSTemplateMail from taiga.base.mails import InlineCSSTemplateMail
from taiga.front.templatetags.functions import resolve as resolve_front_url
from taiga.projects.notifications.choices import NotifyLevel from taiga.projects.notifications.choices import NotifyLevel
from taiga.projects.history.choices import HistoryType from taiga.projects.history.choices import HistoryType
from taiga.projects.history.services import (make_key_from_model_object, from taiga.projects.history.services import (make_key_from_model_object,
@ -276,6 +277,7 @@ def send_sync_notifications(notification_id):
now = datetime.datetime.now() now = datetime.datetime.now()
format_args = { format_args = {
"unsubscribe_url": resolve_front_url('settings-mail-notifications'),
"project_slug": notification.project.slug, "project_slug": notification.project.slug,
"project_name": notification.project.name, "project_name": notification.project.name,
"msg_id": msg_id, "msg_id": msg_id,
@ -288,7 +290,8 @@ def send_sync_notifications(notification_id):
"In-Reply-To": "<{project_slug}/{msg_id}@{domain}>".format(**format_args), "In-Reply-To": "<{project_slug}/{msg_id}@{domain}>".format(**format_args),
"References": "<{project_slug}/{msg_id}@{domain}>".format(**format_args), "References": "<{project_slug}/{msg_id}@{domain}>".format(**format_args),
"List-ID": 'Taiga/{project_name} <taiga.{project_slug}@{domain}>'.format(**format_args), "List-ID": 'Taiga/{project_name} <taiga.{project_slug}@{domain}>'.format(**format_args),
"Thread-Index": make_ms_thread_index("<{project_slug}/{msg_id}@{domain}>".format(**format_args), now) "Thread-Index": make_ms_thread_index("<{project_slug}/{msg_id}@{domain}>".format(**format_args), now),
"List-Unsubscribe": "<{unsubscribe_url}>".format(**format_args),
} }
for user in notification.notify_users.distinct(): for user in notification.notify_users.distinct():