From e967226f8cce329ae782f2549c34988347ffa7b9 Mon Sep 17 00:00:00 2001 From: Prakhar Pratyush Date: Thu, 5 Sep 2024 12:32:56 +0530 Subject: [PATCH] remote_server_email: Add 'unsubscribe link' in the mail footer. Previously, the emails sent to the remote servers had the 'unsubscribe link' only present in the 'List-Unsubscribe' header. Not all email clients expose that header. So, this commit adds the link in the footer too. --- templates/zerver/emails/custom_email_base.pre.html | 1 + zerver/tests/test_email_notifications.py | 1 + 2 files changed, 2 insertions(+) diff --git a/templates/zerver/emails/custom_email_base.pre.html b/templates/zerver/emails/custom_email_base.pre.html index 06edc72f6a..9eb792aa13 100644 --- a/templates/zerver/emails/custom_email_base.pre.html +++ b/templates/zerver/emails/custom_email_base.pre.html @@ -14,6 +14,7 @@ {% block manage_preferences %} {% if remote_server_email %}

You are receiving this email to update you about important changes to Zulip's Terms of Service.

+ Unsubscribe {% elif unsubscribe_link %}

{{ _("Manage email preferences") }} | {{ _("Unsubscribe from marketing emails") }}

{% endif %} diff --git a/zerver/tests/test_email_notifications.py b/zerver/tests/test_email_notifications.py index 26cb9431d8..ecf9507b0b 100644 --- a/zerver/tests/test_email_notifications.py +++ b/zerver/tests/test_email_notifications.py @@ -89,6 +89,7 @@ class TestCustomEmails(ZulipTestCase): "You are receiving this email to update you about important changes to Zulip", str(msg.alternatives[0][0]), ) + self.assertIn("Unsubscribe", str(msg.alternatives[0][0])) def test_send_custom_email_headers(self) -> None: hamlet = self.example_user("hamlet")