emails: Simplify content styling of missed_message emails.

This is a dramatic redesign of the look and feel of our missed-message
emails, designed to decrease the feeling of clutter and just provide
the content users care about in a clear, visible fashion.
This commit is contained in:
Vishnu Ks
2019-06-11 16:09:42 +05:30
committed by Tim Abbott
parent 3a6cc4214f
commit a5c69fb707
7 changed files with 43 additions and 54 deletions

View File

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

View File

@@ -11,36 +11,17 @@
{% endblock %}
{% block content %}
Hello {{ name }},
<p>
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 %}!
</p>
{% if show_message_content %}
<div class='messages'>
{% for recipient_block in messages %}
{% if recipient_block.header.stream_message %}
<div class='recipient_block_with_messages'>
<div class='recipient_header_with_messages'>{{ recipient_block.header.html|safe }}</div>
<div class='message_content_with_messages'>
{% else %}
<div class='recipient_block_without_messages'>
<div class='recipient_header_without_messages'>{{ recipient_block.header.html|safe }}</div>
<div class='message_content_without_messages'>
{% endif %}
{% for sender_block in recipient_block.senders %}
{% if sender_block.sender %} <div class="message_sender">{{ sender_block.sender }}</div>{% endif %}
<div class="missed_message">
{% if sender_block.sender %}<div class="missed_message_sender">{{ sender_block.sender }}</div>{% endif %}
{% for message_block in sender_block.content %}
<div class='message_content_block'>
{{ message_block.html|safe }}
{% endfor %}
</div>
{% endfor %}
{% endfor %}
</div>
</div>
{% endfor %}
</div>
{% endif %}
<p>

View File

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

View File

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

View File

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

View File

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

View File

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