digest: Strip down the digest email removing a lot of fluff.

This commit is contained in:
Puneeth Chaganti 2019-05-01 09:38:05 +05:30 committed by Tim Abbott
parent 7000834a2b
commit be762f9485
4 changed files with 8 additions and 102 deletions

View File

@ -1,44 +1,7 @@
{% extends "zerver/emails/email_base_messages.html" %}
{% block content %}
<p>Hello {{ user_name }},</p>
<p>A lot has happened on Zulip while you've been away! <a href="{{ realm_uri }}">Visit Zulip</a> to catch up.</p>
{% if unread_pms %}
<h2>Missed private messages</h2>
<p>You have some missed private messages. Here are some of them:</p>
<div id='private-messages'>
{% for recipient_block in unread_pms %}
<div class='recipient_block'>
<div class='recipient_header'>{{ recipient_block.header.html|safe }}</div>
<div class='message_content'>
{% for sender_block in recipient_block.senders %}
{% if sender_block.sender %} <div class="message_sender">{{ sender_block.sender }}</div>{% endif %}
{% for message_block in sender_block.content %}
<div class='message_content_block'>
{{ message_block.html|safe }}
</div>
{% endfor %}
{% endfor %}
</div>
</div>
{% endfor %}
{% if remaining_unread_pms_count > 0 %}<p>+ {{ remaining_unread_pms_count }} more new private message{{ remaining_unread_pms_count|pluralize }}</p>
<p><a href="{{ realm_uri }}/#narrow/is/private">Catch up on the rest of your PMs.</a></p>
{% endif %}
</div>
{% endif %}
{% if hot_conversations %}
<br />
<h2>Hot conversations</h2>
<p>
Here are some of the hot conversations that have happened while you've been gone:
</p>
{% for convo in hot_conversations %}
<div class='messages'>
{% for recipient_block in convo.first_few_messages %}
@ -59,39 +22,17 @@
{% endfor %}
</div>
{% endfor %}
<p><a href="{{ realm_uri }}">Catch up on the rest of these conversations.</a></p>
{% endif %}
{% if new_users and new_streams.html %}
<br />
<h2>Group updates</h2>
{% elif new_users %}
<br />
<h2>New users</h2>
{% elif new_streams.html %}
<br />
<h2>New streams</h2>
{% endif %}
{% if new_streams.html %}
<p>{% if new_stream_count and new_stream_count > 1 %}A new stream was{% else %}Some new streams were{% endif %} created:</p>
<p><b>New streams</b></p>
<p>{{ new_streams.html|display_list(4)|safe }}.</p>
<p>Click on {% if new_stream_count and new_stream_count > 1 %}a{% else %}the{% endif %} name to check out some of the traffic, or visit your <a href="{{ realm_uri }}/#streams">Streams page</a> to subscribe.</p>
{% endif %}
{% if new_users %}
<p>{% if new_streams.html or unread_pms or hot_conversations %}And finally, please{% else %}Please{% endif %} welcome {{ new_users|display_list(4) }} to Zulip!</p>
<p>{{ new_streams.html|display_list(1000)|safe }}.</p>
{% endif %}
<br />
<p><a href="{{ realm_uri }}">Click here to log in to Zulip and catch up.</a></p>
<p>Cheers,<br />
The Zulip Team</p>
{% endblock %}
{% block manage_preferences %}

View File

@ -1,52 +1,17 @@
Hello {{ user_name }},
A lot has happened on Zulip while you've been away! Visit
{{ realm_uri }} to catch up.
{% if unread_pms %}
** Missed private messages **
You have some missed private messages. Here are some of them:
{% for recipient_block in unread_pms %}{{ 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 %}{% endfor %}
{% if remaining_unread_pms_count > 0 %}+ {{ remaining_unread_pms_count }} more new private message{{ remaining_unread_pms_count|pluralize }}
Catch up on the rest of your PMs: {{ realm_uri }}/#narrow/is/private{% endif %}{% endif %}
{% if hot_conversations %}
** Hot conversations **
Here are some of the hot conversations that have happened while you've
been gone:
{% for convo in hot_conversations %}{% for recipient_block in convo.first_few_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 %}
{% if convo.count > 0 %}+ {{ convo.count }} more message{{ convo.count|pluralize }} by {{ convo.participants|display_list(4) }}.{% endif %}
{% endfor %}{% endfor %}
Catch up on the rest of these conversations: {{ realm_uri }}.{% endif %}
{% if convo.count > 0 %}+ {{ convo.count }} more message{{ convo.count|pluralize }} by {{ convo.participants|display_list(4) }}.{% endif %}{% endfor %}{% endfor %}{% endif %}
{% if new_users and new_streams.plain %}** Group updates **{% elif new_users %}** New users **{% elif new_streams.plain %}** New streams **{% endif %}
{% if new_streams.plain %}{% if new_stream_count and new_stream_count > 1 %}A new stream was{% else %}Some new streams were{% endif %} created:
{{ new_streams.plain|display_list(4) }}.
Visit your Streams page to subscribe: {{ realm_uri }}/#streams.{% endif %}
{% if new_users %}{% if new_streams.plain or unread_pms or hot_conversations %}And finally, please{% else %}Please{% endif %} welcome {{ new_users|display_list(4) }} to Zulip!{% endif %}
{% if new_streams.plain %}** New streams **
{{ new_streams.plain|display_list(1000) }}.
{% endif %}
Click here to log in to Zulip and catch up: {{ realm_uri }}.
Cheers,
The Zulip Team
--
Manage email preferences:

View File

@ -11,4 +11,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 = '31.0'
PROVISION_VERSION = '31.1'

View File

@ -275,4 +275,4 @@ class TestDigestContentInBrowser(ZulipTestCase):
def test_get_digest_content_in_browser(self) -> None:
self.login(self.example_email('hamlet'))
result = self.client_get("/digest/")
self.assert_in_success_response(["A lot has happened on Zulip while you've been away!"], result)
self.assert_in_success_response(["Click here to log in to Zulip and catch up."], result)