diff --git a/templates/zerver/emails/email.css b/templates/zerver/emails/email.css index c32e5fd089..3668ce3025 100644 --- a/templates/zerver/emails/email.css +++ b/templates/zerver/emails/email.css @@ -290,6 +290,15 @@ a.button:hover { color: #15c; } +.missed_message { + padding-bottom: 10px; +} + +.missed_message_sender { + text-decoration: underline; + font-weight: bold; +} + @media only screen and (max-width: 620px) { table[class=body] h1 { font-size: 28px !important; diff --git a/templates/zerver/emails/missed_message.source.html b/templates/zerver/emails/missed_message.source.html index 219d27f0a4..333ed22e22 100644 --- a/templates/zerver/emails/missed_message.source.html +++ b/templates/zerver/emails/missed_message.source.html @@ -11,36 +11,17 @@ {% endblock %} {% block content %} - Hello {{ name }}, - -

- While you were away you received {{ message_count }} new{% if group_pm %} group private{% elif private_message %} private{% endif %} message{{ message_count|pluralize }}{% if mention %} in which you were mentioned{% endif %}! -

- {% if show_message_content %} -
{% for recipient_block in messages %} - {% if recipient_block.header.stream_message %} -
-
{{ recipient_block.header.html|safe }}
-
- {% else %} -
-
{{ recipient_block.header.html|safe }}
-
- {% endif %} - {% for sender_block in recipient_block.senders %} - {% if sender_block.sender %}
{{ sender_block.sender }}
{% endif %} + {% for sender_block in recipient_block.senders %} +
+ {% if sender_block.sender %}
{{ sender_block.sender }}
{% endif %} {% for message_block in sender_block.content %} -
{{ message_block.html|safe }} -
{% endfor %} - {% endfor %} -
-
+
+ {% endfor %} {% endfor %} -
{% endif %}

diff --git a/templates/zerver/emails/missed_message.subject.txt b/templates/zerver/emails/missed_message.subject.txt index 087df29950..f9e0d37add 100644 --- a/templates/zerver/emails/missed_message.subject.txt +++ b/templates/zerver/emails/missed_message.subject.txt @@ -2,7 +2,7 @@ {% if group_pm %} Group PMs with {{ huddle_display_name }} {% elif mention %} {{ sender_str }} mentioned you {% elif private_message %} PMs with {{ sender_str }} - {% elif stream_email_notify %} #{{ messages[0].header.plain }} + {% elif stream_email_notify %} #{{ stream_header }} {% endif %} {% else %} New missed messages diff --git a/templates/zerver/emails/missed_message.txt b/templates/zerver/emails/missed_message.txt index 18f81d5564..4f6f57ffa4 100644 --- a/templates/zerver/emails/missed_message.txt +++ b/templates/zerver/emails/missed_message.txt @@ -1,21 +1,17 @@ -Hello {{ name }}, - -While you were away you received {{ message_count }} new{% if group_pm %} group private{% elif private_message %} private{% endif %} message{{ message_count|pluralize }}{% if mention %} in which you were mentioned{% endif %}! - {% if show_message_content %} {% for recipient_block in messages %} - {{ recipient_block.header.plain }} - {% for sender_block in recipient_block.senders %} - {% if sender_block.sender %}{{ sender_block.sender }}{% endif %}{% for message_block in sender_block.content %} - {{ message_block.plain }} - {% endfor %} - {% endfor %} +{% for sender_block in recipient_block.senders %} +{% if sender_block.sender %} +{{ sender_block.sender }} +--- +{% endif %} +{% for message_block in sender_block.content %} +{{ message_block.plain }} +{% endfor %} +{% endfor %} {% endfor %} {% endif %} -Cheers, -The Zulip Team - Manage email preferences: {{ realm_uri }}/#settings/notifications diff --git a/version.py b/version.py index 1fabb20521..2f6bff3849 100644 --- a/version.py +++ b/version.py @@ -21,4 +21,4 @@ LATEST_RELEASE_ANNOUNCEMENT = "https://blog.zulip.org/2019/03/01/zulip-2-0-relea # Typically, adding a dependency only requires a minor version bump, and # removing a dependency requires a major version bump. -PROVISION_VERSION = '35.1' +PROVISION_VERSION = '35.2' diff --git a/zerver/lib/email_notifications.py b/zerver/lib/email_notifications.py index 4c3107e76b..9cb885a92c 100644 --- a/zerver/lib/email_notifications.py +++ b/zerver/lib/email_notifications.py @@ -371,7 +371,13 @@ def do_send_missedmessage_events_reply_in_zulip(user_profile: UserProfile, # TODO: When we add wildcard mentions that send emails, we # should make sure the right logic applies here. elif ('stream_email_notify' in unique_triggers): - context.update({'stream_email_notify': True}) + message = missed_messages[0]['message'] + stream = Stream.objects.only('id', 'name').get(id=message.recipient.type_id) + stream_header = "%s > %s" % (stream.name, message.topic_name()) + context.update({ + 'stream_email_notify': True, + 'stream_header': stream_header, + }) else: raise AssertionError("Invalid messages!") diff --git a/zerver/tests/test_email_notifications.py b/zerver/tests/test_email_notifications.py index f024fa7bd2..d97e2f1a69 100644 --- a/zerver/tests/test_email_notifications.py +++ b/zerver/tests/test_email_notifications.py @@ -217,7 +217,7 @@ class TestMissedMessages(ZulipTestCase): self.example_email('hamlet'), 'Extremely personal message!', ) - body = 'You and Othello, the Moor of Venice Extremely personal message!' + body = 'Extremely personal message!' email_subject = 'PMs with Othello, the Moor of Venice' if realm_name_in_notifications: @@ -241,12 +241,12 @@ class TestMissedMessages(ZulipTestCase): '@**King Hamlet**') if show_message_content: - body = 'Denmark > test Othello, the Moor of Venice 1 2 3 4 5 6 7 8 9 10 @**King Hamlet**' + body = 'Othello, the Moor of Venice --- 1 2 3 4 5 6 7 8 9 10 @**King Hamlet**' email_subject = 'Othello, the Moor of Venice mentioned you' verify_body_does_not_include = [] # type: List[str] else: # Test in case if message content in missed email message are disabled. - body = 'While you were away you received 1 new message in which you were mentioned!' + body = 'Manage email preferences: http://zulip.testserver/#settings/notifications' 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', @@ -270,7 +270,7 @@ class TestMissedMessages(ZulipTestCase): msg_id = self.send_stream_message( self.example_email('othello'), "denmark", '12') - body = 'Denmark > test Othello, the Moor of Venice 1 2 3 4 5 6 7 8 9 10 12' + body = 'Othello, the Moor of Venice --- 1 2 3 4 5 6 7 8 9 10 12' email_subject = '#Denmark > test' self._test_cases(tokens, msg_id, body, email_subject, send_as_user, trigger='stream_email_notify') @@ -285,7 +285,7 @@ class TestMissedMessages(ZulipTestCase): msg_id = self.send_stream_message( self.example_email('othello'), "Denmark", '@**King Hamlet**') - body = 'Denmark > test Cordelia Lear 0 1 2 Othello, the Moor of Venice @**King Hamlet**' + body = 'Cordelia Lear --- 0 1 2 Othello, the Moor of Venice --- @**King Hamlet**' email_subject = 'Othello, the Moor of Venice mentioned you' self._test_cases(tokens, msg_id, body, email_subject, send_as_user, trigger='mentioned') @@ -303,11 +303,11 @@ class TestMissedMessages(ZulipTestCase): ) if show_message_content: - body = 'You and Othello, the Moor of Venice Extremely personal message!' + body = 'Extremely personal message!' email_subject = 'PMs with Othello, the Moor of Venice' verify_body_does_not_include = [] # type: List[str] else: - body = 'While you were away you received 1 new private message!' + body = 'Manage email preferences: http://zulip.testserver/#settings/notifications' email_subject = 'New missed messages' verify_body_does_not_include = ['Othello, the Moor of Venice', 'Extremely personal message!', 'mentioned', 'group', 'Reply to this email directly, or view it in Zulip'] @@ -362,12 +362,11 @@ class TestMissedMessages(ZulipTestCase): ) if show_message_content: - body = ('You and Iago, Othello, the Moor of Venice Othello,' - ' the Moor of Venice Group personal message') + body = 'Othello, the Moor of Venice --- Group personal message! Manage email preferences:' email_subject = 'Group PMs with Iago and Othello, the Moor of Venice' verify_body_does_not_include = [] # type: List[str] else: - body = 'While you were away you received 1 new group private message!' + body = 'Manage email preferences: http://zulip.testserver/#settings/notifications' 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', @@ -392,8 +391,7 @@ class TestMissedMessages(ZulipTestCase): 'Group personal message!', ) - body = ('You and Cordelia Lear, Iago, Othello, the Moor of Venice Othello,' - ' the Moor of Venice Group personal message') + body = 'Othello, the Moor of Venice --- Group personal message! Manage email preferences' email_subject = 'Group PMs with Cordelia Lear, Iago, and Othello, the Moor of Venice' self._test_cases(tokens, msg_id, body, email_subject, send_as_user) @@ -410,8 +408,7 @@ class TestMissedMessages(ZulipTestCase): self.example_email('prospero')], 'Group personal message!') - body = ('You and Cordelia Lear, Iago, Othello, the Moor of Venice, Prospero from The Tempest' - ' Othello, the Moor of Venice Group personal message') + body = 'Othello, the Moor of Venice --- Group personal message! Manage email preferences' email_subject = 'Group PMs with Cordelia Lear, Iago, and 2 others' self._test_cases(tokens, msg_id, body, email_subject, send_as_user)