mirror of https://github.com/zulip/zulip.git
notifications: Fix the if/elif order in the manage_preferences block.
The emails sent for missed messages have a text at the bottom explaining the reason why the email was sent. This commit reorders the conditional statements in the email template to align with the trigger priority order defined in the 'get_email_notification_trigger'.
This commit is contained in:
parent
f7e41499fe
commit
5f6dd83696
|
@ -29,14 +29,14 @@
|
||||||
{% trans %}You are receiving this because you were personally mentioned.{% endtrans %}<br />
|
{% trans %}You are receiving this because you were personally mentioned.{% endtrans %}<br />
|
||||||
{% elif mentioned_user_group_name %}
|
{% elif mentioned_user_group_name %}
|
||||||
{% trans %}You are receiving this because @{{ mentioned_user_group_name }} was mentioned.{% endtrans %}<br />
|
{% trans %}You are receiving this because @{{ mentioned_user_group_name }} was mentioned.{% endtrans %}<br />
|
||||||
{% elif wildcard_mentioned %}
|
|
||||||
{% trans %}You are receiving this because everyone was mentioned in #{{ stream_name }}.{% endtrans %}<br />
|
|
||||||
{% elif followed_topic_wildcard_mentioned %}
|
{% elif followed_topic_wildcard_mentioned %}
|
||||||
{% trans %}You are receiving this because you have wildcard mention notifications enabled for topics you follow.{% endtrans %}<br />
|
{% trans %}You are receiving this because you have wildcard mention notifications enabled for topics you follow.{% endtrans %}<br />
|
||||||
{% elif stream_email_notify %}
|
{% elif wildcard_mentioned %}
|
||||||
{% trans %}You are receiving this because you have email notifications enabled for #{{ stream_name }}.{% endtrans %}<br />
|
{% trans %}You are receiving this because everyone was mentioned in #{{ stream_name }}.{% endtrans %}<br />
|
||||||
{% elif followed_topic_email_notify %}
|
{% elif followed_topic_email_notify %}
|
||||||
{% trans %}You are receiving this because you have email notifications enabled for topics you follow.{% endtrans %}<br />
|
{% trans %}You are receiving this because you have email notifications enabled for topics you follow.{% endtrans %}<br />
|
||||||
|
{% elif stream_email_notify %}
|
||||||
|
{% trans %}You are receiving this because you have email notifications enabled for #{{ stream_name }}.{% endtrans %}<br />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if reply_to_zulip %}
|
{% if reply_to_zulip %}
|
||||||
{% trans notif_url=realm_uri + "/#settings/notifications" %}Reply to this email directly, <a href="{{ narrow_url }}">view it in {{ realm_name }} Zulip</a>, or <a href="{{ notif_url }}">manage email preferences</a>.{% endtrans %}
|
{% trans notif_url=realm_uri + "/#settings/notifications" %}Reply to this email directly, <a href="{{ narrow_url }}">view it in {{ realm_name }} Zulip</a>, or <a href="{{ notif_url }}">manage email preferences</a>.{% endtrans %}
|
||||||
|
|
|
@ -25,14 +25,14 @@ See {{ alert_notif_url }} for more details.
|
||||||
{% trans %}You are receiving this because you were personally mentioned.{% endtrans %}
|
{% trans %}You are receiving this because you were personally mentioned.{% endtrans %}
|
||||||
{% elif mentioned_user_group_name %}
|
{% elif mentioned_user_group_name %}
|
||||||
{% trans %}You are receiving this because @{{ mentioned_user_group_name }} was mentioned.{% endtrans %}
|
{% trans %}You are receiving this because @{{ mentioned_user_group_name }} was mentioned.{% endtrans %}
|
||||||
{% elif wildcard_mentioned %}
|
|
||||||
{% trans %}You are receiving this because everyone was mentioned in #{{ stream_name }}.{% endtrans %}
|
|
||||||
{% elif followed_topic_wildcard_mentioned %}
|
{% elif followed_topic_wildcard_mentioned %}
|
||||||
{% trans %}You are receiving this because you have wildcard mention notifications enabled for topics you follow.{% endtrans %}
|
{% trans %}You are receiving this because you have wildcard mention notifications enabled for topics you follow.{% endtrans %}
|
||||||
{% elif stream_email_notify %}
|
{% elif wildcard_mentioned %}
|
||||||
{% trans %}You are receiving this because you have email notifications enabled for #{{ stream_name }}.{% endtrans %}
|
{% trans %}You are receiving this because everyone was mentioned in #{{ stream_name }}.{% endtrans %}
|
||||||
{% elif followed_topic_email_notify %}
|
{% elif followed_topic_email_notify %}
|
||||||
{% trans %}You are receiving this because you have email notifications enabled for topics you follow.{% endtrans %}
|
{% trans %}You are receiving this because you have email notifications enabled for topics you follow.{% endtrans %}
|
||||||
|
{% elif stream_email_notify %}
|
||||||
|
{% trans %}You are receiving this because you have email notifications enabled for #{{ stream_name }}.{% endtrans %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if reply_to_zulip %}
|
{% if reply_to_zulip %}
|
||||||
|
|
|
@ -1061,7 +1061,7 @@ class TestMissedMessages(ZulipTestCase):
|
||||||
for text in expected_email_include:
|
for text in expected_email_include:
|
||||||
self.assertIn(text, self.normalize_string(mail.outbox[0].body))
|
self.assertIn(text, self.normalize_string(mail.outbox[0].body))
|
||||||
|
|
||||||
def test_user_group_over_wildcard_mention_priority(self) -> None:
|
def test_user_group_over_followed_topic_wildcard_mention_priority(self) -> None:
|
||||||
hamlet = self.example_user("hamlet")
|
hamlet = self.example_user("hamlet")
|
||||||
cordelia = self.example_user("cordelia")
|
cordelia = self.example_user("cordelia")
|
||||||
othello = self.example_user("othello")
|
othello = self.example_user("othello")
|
||||||
|
@ -1070,7 +1070,9 @@ class TestMissedMessages(ZulipTestCase):
|
||||||
get_realm("zulip"), "hamlet_and_cordelia", [hamlet, cordelia], acting_user=None
|
get_realm("zulip"), "hamlet_and_cordelia", [hamlet, cordelia], acting_user=None
|
||||||
)
|
)
|
||||||
|
|
||||||
wildcard_mentioned_message_id = self.send_stream_message(othello, "Denmark", "@**all**")
|
followed_topic_wildcard_mentioned_message_id = self.send_stream_message(
|
||||||
|
othello, "Denmark", "@**all**"
|
||||||
|
)
|
||||||
user_group_mentioned_message_id = self.send_stream_message(
|
user_group_mentioned_message_id = self.send_stream_message(
|
||||||
othello, "Denmark", "@*hamlet_and_cordelia*"
|
othello, "Denmark", "@*hamlet_and_cordelia*"
|
||||||
)
|
)
|
||||||
|
@ -1079,8 +1081,8 @@ class TestMissedMessages(ZulipTestCase):
|
||||||
hamlet.id,
|
hamlet.id,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"message_id": wildcard_mentioned_message_id,
|
"message_id": followed_topic_wildcard_mentioned_message_id,
|
||||||
"trigger": "wildcard_mentioned",
|
"trigger": "followed_topic_wildcard_mentioned",
|
||||||
"mentioned_user_group_id": None,
|
"mentioned_user_group_id": None,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1099,19 +1101,52 @@ class TestMissedMessages(ZulipTestCase):
|
||||||
for text in expected_email_include:
|
for text in expected_email_include:
|
||||||
self.assertIn(text, self.normalize_string(mail.outbox[0].body))
|
self.assertIn(text, self.normalize_string(mail.outbox[0].body))
|
||||||
|
|
||||||
def test_wildcard_over_stream_mention_priority(self) -> None:
|
def test_followed_topic_wildcard_over_wildcard_mention_priority(self) -> None:
|
||||||
hamlet = self.example_user("hamlet")
|
hamlet = self.example_user("hamlet")
|
||||||
othello = self.example_user("othello")
|
othello = self.example_user("othello")
|
||||||
|
|
||||||
stream_mentioned_message_id = self.send_stream_message(othello, "Denmark", "1")
|
wildcard_mentioned_message_id = self.send_stream_message(othello, "Denmark", "@**all**")
|
||||||
|
followed_topic_wildcard_mentioned_message_id = self.send_stream_message(
|
||||||
|
othello, "Denmark", "@**all**"
|
||||||
|
)
|
||||||
|
|
||||||
|
handle_missedmessage_emails(
|
||||||
|
hamlet.id,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"message_id": wildcard_mentioned_message_id,
|
||||||
|
"trigger": "wildcard_mentioned",
|
||||||
|
"mentioned_user_group_id": None,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"message_id": followed_topic_wildcard_mentioned_message_id,
|
||||||
|
"trigger": "followed_topic_wildcard_mentioned",
|
||||||
|
"mentioned_user_group_id": None,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
expected_email_include = [
|
||||||
|
"Othello, the Moor of Venice: > @**all** > @**all** -- ",
|
||||||
|
"You are receiving this because you have wildcard mention notifications enabled for topics you follow.",
|
||||||
|
]
|
||||||
|
|
||||||
|
for text in expected_email_include:
|
||||||
|
self.assertIn(text, self.normalize_string(mail.outbox[0].body))
|
||||||
|
|
||||||
|
def test_wildcard_mention_over_followed_topic_notify_priority(self) -> None:
|
||||||
|
hamlet = self.example_user("hamlet")
|
||||||
|
othello = self.example_user("othello")
|
||||||
|
|
||||||
|
followed_topic_mentioned_message_id = self.send_stream_message(othello, "Denmark", "1")
|
||||||
wildcard_mentioned_message_id = self.send_stream_message(othello, "Denmark", "@**all**")
|
wildcard_mentioned_message_id = self.send_stream_message(othello, "Denmark", "@**all**")
|
||||||
|
|
||||||
handle_missedmessage_emails(
|
handle_missedmessage_emails(
|
||||||
hamlet.id,
|
hamlet.id,
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"message_id": stream_mentioned_message_id,
|
"message_id": followed_topic_mentioned_message_id,
|
||||||
"trigger": "stream_email_notify",
|
"trigger": "followed_topic_email_notify",
|
||||||
"mentioned_user_group_id": None,
|
"mentioned_user_group_id": None,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1130,6 +1165,37 @@ class TestMissedMessages(ZulipTestCase):
|
||||||
for text in expected_email_include:
|
for text in expected_email_include:
|
||||||
self.assertIn(text, self.normalize_string(mail.outbox[0].body))
|
self.assertIn(text, self.normalize_string(mail.outbox[0].body))
|
||||||
|
|
||||||
|
def test_followed_topic_notify_over_stream_message_notify_priority(self) -> None:
|
||||||
|
hamlet = self.example_user("hamlet")
|
||||||
|
othello = self.example_user("othello")
|
||||||
|
|
||||||
|
stream_mentioned_message_id = self.send_stream_message(othello, "Denmark", "0")
|
||||||
|
followed_topic_mentioned_message_id = self.send_stream_message(othello, "Denmark", "1")
|
||||||
|
|
||||||
|
handle_missedmessage_emails(
|
||||||
|
hamlet.id,
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"message_id": stream_mentioned_message_id,
|
||||||
|
"trigger": "stream_email_notify",
|
||||||
|
"mentioned_user_group_id": None,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"message_id": followed_topic_mentioned_message_id,
|
||||||
|
"trigger": "followed_topic_email_notify",
|
||||||
|
"mentioned_user_group_id": None,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
expected_email_include = [
|
||||||
|
"Othello, the Moor of Venice: > 0 > 1 -- ",
|
||||||
|
"You are receiving this because you have email notifications enabled for topics you follow.",
|
||||||
|
]
|
||||||
|
|
||||||
|
for text in expected_email_include:
|
||||||
|
self.assertIn(text, self.normalize_string(mail.outbox[0].body))
|
||||||
|
|
||||||
def test_include_realm_name_in_missedmessage_emails_subject(self) -> None:
|
def test_include_realm_name_in_missedmessage_emails_subject(self) -> None:
|
||||||
user = self.example_user("hamlet")
|
user = self.example_user("hamlet")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue