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.)
This commit is contained in:
Vishnu Ks
2019-06-18 12:15:23 +00:00
committed by Tim Abbott
parent f67c85892b
commit 3a6cc4214f
4 changed files with 31 additions and 31 deletions

View File

@@ -43,18 +43,6 @@
</div>
{% endif %}
<p>
<a href="{{ realm_uri }}">Click here to log in to Zulip and view your new messages.</a>
{% if reply_to_zulip %}
Or just reply to this email.
{% endif %}
</p>
{% if reply_warning %}
<p>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.</p>
{% endif %}
<p>
Cheers,
<br />
@@ -66,5 +54,11 @@
<div class="email-preferences">
&mdash;<br>
<a href="{{ realm_uri }}/#settings/notifications">Manage email preferences</a> | <a href="{{ unsubscribe_link }}">Unsubscribe</a> from missed message emails.<br>
{% if reply_to_zulip %}
Reply to this email directly, or <a href="{{ narrow_url }}">view it in Zulip</a><br>
{% else %}
Do not reply to this message. This Zulip server is not
configured to accept incoming emails (<a href="https://zulip.readthedocs.io/en/latest/production/settings.html#miscellaneous-server-settings">help</a>). <a href="{{ narrow_url }}">Reply in Zulip</a>.<br>
{% endif %}
</div>
{% endblock %}

View File

@@ -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 %}

View File

@@ -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,
})

View File

@@ -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)