From f1df72154602c5d741d9eb5c47922cd946b92c27 Mon Sep 17 00:00:00 2001 From: Carina Antunes <carina.oliveira.antunes@cern.ch> Date: Tue, 15 Jun 2021 16:05:27 +0200 Subject: [PATCH] [hotfix] remove unsubscribe link from dlq emails --- notifications_consumer/email_templates/base_email.html | 6 ++++-- .../processors/email/templates/notification_body.html | 2 +- notifications_consumer/processors/email/utils.py | 5 +++-- .../email_daily/templates/daily_notification.html | 4 ++-- .../processors/email_gateway_failure/processor.py | 1 + 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/notifications_consumer/email_templates/base_email.html b/notifications_consumer/email_templates/base_email.html index 821b1c0..838905c 100644 --- a/notifications_consumer/email_templates/base_email.html +++ b/notifications_consumer/email_templates/base_email.html @@ -43,8 +43,10 @@ <p style="padding: 10px;"> This notification has been sent by CERN Notifications. <br/> <a href="{{ base_url }}/#subscriptions">Manage your subscriptions</a> | - <a href="{{ base_url }}/#manage">Manage your channels</a> | - <a href="{{ base_url }}/unsubscribe/{{ unsubscribe_blob }}/{{ unsubscribe_mail }}">Unsubscribe</a> + <a href="{{ base_url }}/#manage">Manage your channels</a> + {% if unsubscribe_blob %} + | <a href="{{ base_url }}/unsubscribe/{{ unsubscribe_blob }}/{{ unsubscribe_mail }}">Unsubscribe</a> + {% endif %} </p> </td> </tr> diff --git a/notifications_consumer/processors/email/templates/notification_body.html b/notifications_consumer/processors/email/templates/notification_body.html index 4369574..fcd8cf0 100644 --- a/notifications_consumer/processors/email/templates/notification_body.html +++ b/notifications_consumer/processors/email/templates/notification_body.html @@ -8,7 +8,7 @@ ⚠ </span> {% endif %} - <span style="color: #3071AB; font-size: 1.2em;">{{ summary }}</span></b> + <span style="color: #3071AB; font-size: 1.2em; vertical-align: middle;">{{ summary }}</span></b> </a> <br/> <span style="color: #aaa;">{{ created_at }}</span> diff --git a/notifications_consumer/processors/email/utils.py b/notifications_consumer/processors/email/utils.py index e635ea5..8cf95f8 100644 --- a/notifications_consumer/processors/email/utils.py +++ b/notifications_consumer/processors/email/utils.py @@ -24,9 +24,10 @@ def create_email( recipient_emails: List that should contain only one recipient for customized content to work """ + context["base_url"] = Config.WEB_URL + context["service_name"] = Config.SERVICE_NAME + if not internal: - context["base_url"] = Config.WEB_URL - context["service_name"] = Config.SERVICE_NAME aes = AESCipher(Config.EMAIL_AES_SECRET_KEY[:32]) context["unsubscribe_blob"] = aes.encrypt(recipient_emails[0]) context["unsubscribe_mail"] = urllib.parse.quote_plus(recipient_emails[0]) diff --git a/notifications_consumer/processors/email_daily/templates/daily_notification.html b/notifications_consumer/processors/email_daily/templates/daily_notification.html index a007e0e..253cb02 100644 --- a/notifications_consumer/processors/email_daily/templates/daily_notification.html +++ b/notifications_consumer/processors/email_daily/templates/daily_notification.html @@ -24,11 +24,11 @@ {% for notification in notifications[:3] %} <tr> <td style="padding:10px"> - <p style="line-height: 145%;"><b>{% if notification.priority and notification.priority.upper() == + <p><b>{% if notification.priority and notification.priority.upper() == notification_priority.IMPORTANT %} <span style="color: #FF5144; font-size: 1.5em; vertical-align: middle;"> ⚠</span> {% endif %} - <span style="color: #3071AB;">{{ notification.summary }}</span></b> + <span style="color: #3071AB; font-size: 1.2em; vertical-align: middle;">{{ notification.summary }}</span></b> <br> {{ notification.body|striptags|trim|truncate(250, True) }} <a style="text-decoration:none" diff --git a/notifications_consumer/processors/email_gateway_failure/processor.py b/notifications_consumer/processors/email_gateway_failure/processor.py index 2800d86..a06a392 100644 --- a/notifications_consumer/processors/email_gateway_failure/processor.py +++ b/notifications_consumer/processors/email_gateway_failure/processor.py @@ -107,6 +107,7 @@ class EmailGatewayFailureProcessor(Processor): text_template, html_template, context, + True ) return send_emails([email]) -- GitLab