email-notifs: Concatenate topic subject lines only in Jinja.

Previously, stream names and topics (without consideration for their
resolution status) were concatenated in Python-land and passed through
to the template. To more cleanly separate concerns, and to prepare for
accounting for topic resolution status being a third, independent,
component of a subject line, instead pass stream and topic strings
independently to the Jinja template, which can format them as it sees
fit.
This commit is contained in:
Josh Klar 2022-10-27 19:19:22 -07:00 committed by Tim Abbott
parent 5a9b33fa94
commit 69c042bff6
2 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
{% if show_message_content %}
{% if group_pm %} {% trans %}Group PMs with {{ huddle_display_name }}{% endtrans %}
{% elif private_message %} {% trans %}PMs with {{ sender_str }}{% endtrans %}
{% elif stream_email_notify or mention %} #{{ stream_header }}
{% elif stream_email_notify or mention %} #{{ stream_name }} > {{ topic_name }}
{% endif %}
{% else %}
{% trans %}New messages{% endtrans %}

View File

@ -481,10 +481,10 @@ def do_send_missedmessage_events_reply_in_zulip(
)
message = missed_messages[0]["message"]
stream = Stream.objects.only("id", "name").get(id=message.recipient.type_id)
stream_header = f"{stream.name} > {message.topic_name()}"
topic_name = message.topic_name()
context.update(
stream_name=stream.name,
stream_header=stream_header,
topic_name=topic_name,
)
else:
raise AssertionError("Invalid messages!")