From 3a6cc4214ff6677a2a8874deaef7f7e8b1d79dc0 Mon Sep 17 00:00:00 2001 From: Vishnu Ks Date: Tue, 18 Jun 2019 12:15:23 +0000 Subject: [PATCH] emails: Improve the reply wording in missed_message emails. This cleans up the reply_warning feature in favor of a more coherent explanation of whether or not one can reply. (Also, critically, it now advertises the ability to enable missed-message email replies with some administrative configuration work.) --- .../zerver/emails/missed_message.source.html | 18 +++++-------- templates/zerver/emails/missed_message.txt | 26 +++++++++++-------- zerver/lib/email_notifications.py | 8 +++--- zerver/tests/test_email_notifications.py | 10 +++---- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/templates/zerver/emails/missed_message.source.html b/templates/zerver/emails/missed_message.source.html index acbb19cc4a..219d27f0a4 100644 --- a/templates/zerver/emails/missed_message.source.html +++ b/templates/zerver/emails/missed_message.source.html @@ -43,18 +43,6 @@ {% endif %} - -

- Click here to log in to Zulip and view your new messages. - {% if reply_to_zulip %} - Or just reply to this email. - {% endif %} -

- - {% if reply_warning %} -

Please do not reply to this automated message. To respond to the missed messages you have received, please log on to Zulip and send your replies there.

- {% endif %} -

Cheers,
@@ -66,5 +54,11 @@


Manage email preferences | Unsubscribe from missed message emails.
+ {% if reply_to_zulip %} + Reply to this email directly, or view it in Zulip
+ {% else %} + Do not reply to this message. This Zulip server is not + configured to accept incoming emails (help). Reply in Zulip.
+ {% endif %}
{% endblock %} diff --git a/templates/zerver/emails/missed_message.txt b/templates/zerver/emails/missed_message.txt index 9eb35a3781..18f81d5564 100644 --- a/templates/zerver/emails/missed_message.txt +++ b/templates/zerver/emails/missed_message.txt @@ -13,17 +13,6 @@ While you were away you received {{ message_count }} new{% if group_pm %} group {% endfor %} {% endif %} -Click here to log in to Zulip and view your new messages: - -{{ realm_uri }} - -{% if reply_to_zulip %} -Or just reply to this email. -{% endif %} -{% if reply_warning %} -Please do not reply to this automated message. To respond to the missed messages you have received, please log on to Zulip and send your replies there. -{% endif %} - Cheers, The Zulip Team @@ -34,3 +23,18 @@ Manage email preferences: Unsubscribe from missed message emails: {{ unsubscribe_link }} + +{% if reply_to_zulip %} +Reply to this email directly, or view it in Zulip: + +{{ narrow_url }} +{% else %} +Do not reply to this message. This Zulip server is not configured to accept +incoming emails. Help: + +https://zulip.readthedocs.io/en/latest/production/settings.html#miscellaneous-server-settings + +Reply in Zulip: + +{{ narrow_url }} +{% endif %} diff --git a/zerver/lib/email_notifications.py b/zerver/lib/email_notifications.py index bd4567c253..4c3107e76b 100644 --- a/zerver/lib/email_notifications.py +++ b/zerver/lib/email_notifications.py @@ -324,12 +324,10 @@ def do_send_missedmessage_events_reply_in_zulip(user_profile: UserProfile, # ensure to display warning in the template. if settings.EMAIL_GATEWAY_PATTERN: context.update({ - 'reply_warning': False, 'reply_to_zulip': True, }) else: context.update({ - 'reply_warning': True, 'reply_to_zulip': False, }) @@ -340,6 +338,11 @@ def do_send_missedmessage_events_reply_in_zulip(user_profile: UserProfile, else: reply_to_name = "Zulip" + narrow_url = get_narrow_url(user_profile, missed_messages[0]['message']) + context.update({ + 'narrow_url': narrow_url, + }) + senders = list(set(m['message'].sender for m in missed_messages)) if (missed_messages[0]['message'].recipient.type == Recipient.HUDDLE): display_recipient = get_display_recipient(missed_messages[0]['message'].recipient) @@ -399,7 +402,6 @@ def do_send_missedmessage_events_reply_in_zulip(user_profile: UserProfile, sender = senders[0] from_name, from_address = (sender.full_name, sender.email) context.update({ - 'reply_warning': False, 'reply_to_zulip': False, }) diff --git a/zerver/tests/test_email_notifications.py b/zerver/tests/test_email_notifications.py index 9e6e839268..f024fa7bd2 100644 --- a/zerver/tests/test_email_notifications.py +++ b/zerver/tests/test_email_notifications.py @@ -250,7 +250,7 @@ class TestMissedMessages(ZulipTestCase): email_subject = 'New missed messages' verify_body_does_not_include = ['Denmark > test', 'Othello, the Moor of Venice', '1 2 3 4 5 6 7 8 9 10 @**King Hamlet**', 'private', 'group', - 'Or just reply to this email.'] + 'Reply to this email directly, or view it in Zulip'] self._test_cases(tokens, msg_id, body, email_subject, send_as_user, show_message_content=show_message_content, verify_body_does_not_include=verify_body_does_not_include, @@ -310,7 +310,7 @@ class TestMissedMessages(ZulipTestCase): body = 'While you were away you received 1 new private message!' email_subject = 'New missed messages' verify_body_does_not_include = ['Othello, the Moor of Venice', 'Extremely personal message!', - 'mentioned', 'group', 'Or just reply to this email.'] + 'mentioned', 'group', 'Reply to this email directly, or view it in Zulip'] self._test_cases(tokens, msg_id, body, email_subject, send_as_user, show_message_content=show_message_content, verify_body_does_not_include=verify_body_does_not_include) @@ -326,7 +326,7 @@ class TestMissedMessages(ZulipTestCase): self.example_email('hamlet'), 'Extremely personal message!', ) - body = 'Or just reply to this email.' + body = 'Reply to this email directly, or view it in Zulip' email_subject = 'PMs with Othello, the Moor of Venice' self._test_cases(tokens, msg_id, body, email_subject, send_as_user) @@ -341,7 +341,7 @@ class TestMissedMessages(ZulipTestCase): self.example_email('hamlet'), 'Extremely personal message!', ) - body = 'Please do not reply to this automated message.' + body = 'Do not reply to this message.' email_subject = 'PMs with Othello, the Moor of Venice' self._test_cases(tokens, msg_id, body, email_subject, send_as_user) @@ -371,7 +371,7 @@ class TestMissedMessages(ZulipTestCase): email_subject = 'New missed messages' verify_body_does_not_include = ['Iago', 'Othello, the Moor of Venice Othello, the Moor of Venice', 'Group personal message!', 'mentioned', - 'Or just reply to this email.'] + 'Reply to this email directly, or view it in Zulip'] self._test_cases(tokens, msg_id, body, email_subject, send_as_user, show_message_content=show_message_content, verify_body_does_not_include=verify_body_does_not_include)