mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 17:36:27 +00:00
@@ -1,4 +1,3 @@
|
|||||||
{% load app_filters %}
|
|
||||||
{#
|
{#
|
||||||
Mail sent to a user who hasn't logged in for 24 hours.
|
Mail sent to a user who hasn't logged in for 24 hours.
|
||||||
#}
|
#}
|
||||||
@@ -32,20 +31,20 @@ been gone:
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% for message_block in sender_block.content %}{{ message_block.plain }}
|
{% for message_block in sender_block.content %}{{ message_block.plain }}
|
||||||
{% endfor %}{% endfor %}
|
{% endfor %}{% endfor %}
|
||||||
{% if convo.count > 0 %}+ {{ convo.count }} more message{{ convo.count|pluralize }} by {{ convo.participants|display_list:4 }}.{% endif %}
|
{% if convo.count > 0 %}+ {{ convo.count }} more message{{ convo.count|pluralize }} by {{ convo.participants|display_list(4) }}.{% endif %}
|
||||||
{% endfor %}{% endfor %}
|
{% endfor %}{% endfor %}
|
||||||
Catch up on the rest of these conversations: https://{{ external_host }}.{% endif %}
|
Catch up on the rest of these conversations: https://{{ external_host }}.{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{% if new_users and new_streams.plain %}** Group updates **{% elif new_users %}** New users **{% elif new_streams.plain %}** New streams **{% 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 > 1 %}A new stream was{% else %}Some new streams were{% endif %} created:
|
{% 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 }}.
|
{{ new_streams.plain|display_list(4) }}.
|
||||||
|
|
||||||
Visit your Streams page to subscribe: https://{{ external_host }}/#subscriptions.{% endif %}
|
Visit your Streams page to subscribe: https://{{ external_host }}/#subscriptions.{% 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_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 %}
|
||||||
|
|
||||||
Click here to log in to Zulip and catch up: https://{{ external_host }}.
|
Click here to log in to Zulip and catch up: https://{{ external_host }}.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
{% load app_filters %}
|
|
||||||
{#
|
{#
|
||||||
Mail sent to a user who hasn't logged in for 24 hours.
|
Mail sent to a user who hasn't logged in for 24 hours.
|
||||||
#}
|
#}
|
||||||
@@ -56,7 +55,7 @@ Here are some of the hot conversations that have happened while you've been gone
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% if convo.count > 0 %}<p>+ {{ convo.count }} more message{{ convo.count|pluralize }} by {{ convo.participants|display_list:4 }}.</p>{% endif %}
|
{% if convo.count > 0 %}<p>+ {{ convo.count }} more message{{ convo.count|pluralize }} by {{ convo.participants|display_list(4) }}.</p>{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -76,15 +75,15 @@ Here are some of the hot conversations that have happened while you've been gone
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if new_streams.html %}
|
{% if new_streams.html %}
|
||||||
<p>{% if new_stream_count > 1 %}A new stream was{% else %}Some new streams were{% endif %} created:</p>
|
<p>{% if new_stream_count and new_stream_count > 1 %}A new stream was{% else %}Some new streams were{% endif %} created:</p>
|
||||||
|
|
||||||
<p>{{ new_streams.html|display_list:4|safe }}.</p>
|
<p>{{ new_streams.html|display_list(4)|safe }}.</p>
|
||||||
|
|
||||||
<p>Click on {% if new_stream_count > 1 %}a{% else %}the{% endif %} name to check out some of the traffic, or visit your <a href="https://{{ external_host }}/#subscriptions">Streams page</a> to subscribe.</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="https://{{ external_host }}/#subscriptions">Streams page</a> to subscribe.</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if new_users %}
|
{% 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>{% 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>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ from zerver.lib.email_mirror import (
|
|||||||
create_missed_message_address,
|
create_missed_message_address,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from zerver.lib.digest import handle_digest_email
|
||||||
|
|
||||||
from zerver.lib.notifications import (
|
from zerver.lib.notifications import (
|
||||||
handle_missedmessage_emails,
|
handle_missedmessage_emails,
|
||||||
)
|
)
|
||||||
@@ -32,6 +34,7 @@ import datetime
|
|||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
import ujson
|
import ujson
|
||||||
|
import mock
|
||||||
|
|
||||||
|
|
||||||
class TestStreamEmailMessagesSuccess(AuthedTestCase):
|
class TestStreamEmailMessagesSuccess(AuthedTestCase):
|
||||||
@@ -183,3 +186,25 @@ class TestMissedHuddleMessageEmailMessages(AuthedTestCase):
|
|||||||
self.assertEqual(message.content, "TestMissedHuddleMessageEmailMessages Body")
|
self.assertEqual(message.content, "TestMissedHuddleMessageEmailMessages Body")
|
||||||
self.assertEqual(message.sender, get_user_profile_by_email("cordelia@zulip.com"))
|
self.assertEqual(message.sender, get_user_profile_by_email("cordelia@zulip.com"))
|
||||||
self.assertEqual(message.recipient.type, Recipient.HUDDLE)
|
self.assertEqual(message.recipient.type, Recipient.HUDDLE)
|
||||||
|
|
||||||
|
class TestDigestEmailMessages(AuthedTestCase):
|
||||||
|
@mock.patch('zerver.lib.digest.enough_traffic')
|
||||||
|
@mock.patch('zerver.lib.digest.send_future_email')
|
||||||
|
def test_receive_digest_email_messages(self, mock_send_future_email, mock_enough_traffic):
|
||||||
|
|
||||||
|
# build dummy messages for missed messages email reply
|
||||||
|
# have Hamlet send Othello a PM. Othello will reply via email
|
||||||
|
# Hamlet will receive the message.
|
||||||
|
self.login("hamlet@zulip.com")
|
||||||
|
result = self.client.post("/json/messages", {"type": "private",
|
||||||
|
"content": "test_receive_missed_message_email_messages",
|
||||||
|
"client": "test suite",
|
||||||
|
"to": "othello@zulip.com"})
|
||||||
|
self.assert_json_success(result)
|
||||||
|
|
||||||
|
user_profile = get_user_profile_by_email("othello@zulip.com")
|
||||||
|
cutoff = time.mktime(datetime.datetime(year=2016, month=1, day=1).timetuple())
|
||||||
|
handle_digest_email(user_profile.id, cutoff)
|
||||||
|
self.assertEqual(mock_send_future_email.call_count, 1)
|
||||||
|
self.assertEqual(mock_send_future_email.call_args[0][0][0]['email'],
|
||||||
|
u'othello@zulip.com')
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ from django.http import HttpResponse
|
|||||||
from jinja2 import Environment
|
from jinja2 import Environment
|
||||||
|
|
||||||
from .compressors import compressed_css, minified_js
|
from .compressors import compressed_css, minified_js
|
||||||
|
from zerver.templatetags.app_filters import display_list
|
||||||
|
|
||||||
|
|
||||||
def render_to_response(*args, **kwargs):
|
def render_to_response(*args, **kwargs):
|
||||||
@@ -29,5 +30,6 @@ def environment(**options):
|
|||||||
|
|
||||||
env.filters['slugify'] = slugify
|
env.filters['slugify'] = slugify
|
||||||
env.filters['pluralize'] = pluralize
|
env.filters['pluralize'] = pluralize
|
||||||
|
env.filters['display_list'] = display_list
|
||||||
|
|
||||||
return env
|
return env
|
||||||
|
|||||||
Reference in New Issue
Block a user