mirror of https://github.com/zulip/zulip.git
email: Replace `uri` with `url` in templates and backend.
In #23380 we want to change all ocurrences of `uri` to `url`. This commit changes the ocurrences of `uri` appeared in files related to email, including templates (`.html`, `.txt`) and backend (`.py`) codes. In `email.md`, `base_images_uri` is changed to `images_base_url` - the words `base` and `images` are swapped and plural form is added for `image`. This is becasue the former is not found anywhere in the codebase while the later appears a lot. To reduce confusion, this doccumentation changed accordingly.
This commit is contained in:
parent
e4420bcd61
commit
4544eb4576
|
@ -105,7 +105,7 @@ email_password = gmail_password
|
||||||
### Notes
|
### Notes
|
||||||
|
|
||||||
- Images won't be displayed in a real email client unless you change
|
- Images won't be displayed in a real email client unless you change
|
||||||
the `base_image_uri` used for emails to a public URL such as
|
the `images_base_url` used for emails to a public URL such as
|
||||||
`https://chat.zulip.org/static/images/emails` (image links to
|
`https://chat.zulip.org/static/images/emails` (image links to
|
||||||
`localhost:9991` aren't allowed by modern email providers). See
|
`localhost:9991` aren't allowed by modern email providers). See
|
||||||
`zproject/email_backends.py` for more details.
|
`zproject/email_backends.py` for more details.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% extends "zerver/emails/email_base_default.html" %}
|
{% extends "zerver/emails/email_base_default.html" %}
|
||||||
|
|
||||||
{% block illustration %}
|
{% block illustration %}
|
||||||
<img src="{{ email_images_base_uri }}/email_logo.png" alt=""/>
|
<img src="{{ email_images_base_url }}/email_logo.png" alt=""/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% extends "zerver/emails/email_base_default.html" %}
|
{% extends "zerver/emails/email_base_default.html" %}
|
||||||
|
|
||||||
{% block illustration %}
|
{% block illustration %}
|
||||||
<img src="{{ email_images_base_uri }}/registration_confirmation.png" alt=""/>
|
<img src="{{ email_images_base_url }}/registration_confirmation.png" alt=""/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% extends "zerver/emails/email_base_marketing.html" %}
|
{% extends "zerver/emails/email_base_marketing.html" %}
|
||||||
|
|
||||||
{% block illustration %}
|
{% block illustration %}
|
||||||
<img src="{{ email_images_base_uri }}/email_logo.png" alt=""/>
|
<img src="{{ email_images_base_url }}/email_logo.png" alt=""/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% extends "zerver/emails/email_base_default.html" %}
|
{% extends "zerver/emails/email_base_default.html" %}
|
||||||
|
|
||||||
{% block illustration %}
|
{% block illustration %}
|
||||||
<img src="{{ email_images_base_uri }}/email_logo.png" alt=""/>
|
<img src="{{ email_images_base_url }}/email_logo.png" alt=""/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
{{ new_streams.plain|display_list(1000) }}.
|
{{ new_streams.plain|display_list(1000) }}.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% trans organization_uri=realm_uri %}Click here to log in to Zulip and catch up: {{ organization_uri }}.{% endtrans %}
|
{% trans organization_url=realm_uri %}Click here to log in to Zulip and catch up: {{ organization_url }}.{% endtrans %}
|
||||||
|
|
||||||
--
|
--
|
||||||
{% trans %}Manage email preferences:{% endtrans %}
|
{% trans %}Manage email preferences:{% endtrans %}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<img class="bottom-illustration" src="{{ email_images_base_uri }}/footer.png" alt="{{ _('Swimming fish') }}"/>
|
<img class="bottom-illustration" src="{{ email_images_base_url }}/footer.png" alt="{{ _('Swimming fish') }}"/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<img src="{{ email_images_base_uri }}/footer.png" alt="{{ _('Swimming fish') }}"/>
|
<img src="{{ email_images_base_url }}/footer.png" alt="{{ _('Swimming fish') }}"/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% extends "zerver/emails/email_base_default.html" %}
|
{% extends "zerver/emails/email_base_default.html" %}
|
||||||
|
|
||||||
{% block illustration %}
|
{% block illustration %}
|
||||||
<img src="{{ email_images_base_uri }}/email_logo.png" alt=""/>
|
<img src="{{ email_images_base_url }}/email_logo.png" alt=""/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% extends "zerver/emails/email_base_default.html" %}
|
{% extends "zerver/emails/email_base_default.html" %}
|
||||||
|
|
||||||
{% block illustration %}
|
{% block illustration %}
|
||||||
<img src="{{ email_images_base_uri }}/email_logo.png" alt=""/>
|
<img src="{{ email_images_base_url }}/email_logo.png" alt=""/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% extends "zerver/emails/email_base_default.html" %}
|
{% extends "zerver/emails/email_base_default.html" %}
|
||||||
|
|
||||||
{% block illustration %}
|
{% block illustration %}
|
||||||
<img src="{{ email_images_base_uri }}/day2_1.png" alt=""/>
|
<img src="{{ email_images_base_url }}/day2_1.png" alt=""/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
{{ _("To kick off a new conversation, just pick a stream and start a new topic. This way, the new conversation thread won't interrupt ongoing discussions. For a good topic name, think about finishing the sentence: “Hey, can we chat about…?”") }}
|
{{ _("To kick off a new conversation, just pick a stream and start a new topic. This way, the new conversation thread won't interrupt ongoing discussions. For a good topic name, think about finishing the sentence: “Hey, can we chat about…?”") }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<img src="{{ email_images_base_uri }}/day2_2.png" alt="{{ _('Examples of short topics') }}"/>
|
<img src="{{ email_images_base_url }}/day2_2.png" alt="{{ _('Examples of short topics') }}"/>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{% trans %}Don't stress about picking the perfect name for your topic. If anything is out of place, it's easy to <a href="{{ move_messages_link }}">move messages</a>, <a href="{{ rename_topics_link }}">rename topics</a>, or even <a href="{{ move_topic_to_different_stream_link }}">move a topic to a different stream</a>.{% endtrans %}
|
{% trans %}Don't stress about picking the perfect name for your topic. If anything is out of place, it's easy to <a href="{{ move_messages_link }}">move messages</a>, <a href="{{ rename_topics_link }}">rename topics</a>, or even <a href="{{ move_topic_to_different_stream_link }}">move a topic to a different stream</a>.{% endtrans %}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% extends "zerver/emails/email_base_default.html" %}
|
{% extends "zerver/emails/email_base_default.html" %}
|
||||||
|
|
||||||
{% block illustration %}
|
{% block illustration %}
|
||||||
<img src="{{ email_images_base_uri }}/registration_confirmation.png" alt=""/>
|
<img src="{{ email_images_base_url }}/registration_confirmation.png" alt=""/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% extends "zerver/emails/email_base_default.html" %}
|
{% extends "zerver/emails/email_base_default.html" %}
|
||||||
|
|
||||||
{% block illustration %}
|
{% block illustration %}
|
||||||
<img src="{{ email_images_base_uri }}/invitation_reminder.png" alt=""/>
|
<img src="{{ email_images_base_url }}/invitation_reminder.png" alt=""/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% extends "zerver/emails/email_base_default.html" %}
|
{% extends "zerver/emails/email_base_default.html" %}
|
||||||
|
|
||||||
{% block illustration %}
|
{% block illustration %}
|
||||||
<img src="{{ email_images_base_uri }}/email_logo.png" alt=""/>
|
<img src="{{ email_images_base_url }}/email_logo.png" alt=""/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block illustration %}
|
{% block illustration %}
|
||||||
<img src="{{ email_images_base_uri }}/email_logo.png" alt=""/>
|
<img src="{{ email_images_base_url }}/email_logo.png" alt=""/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% extends "zerver/emails/email_base_default.html" %}
|
{% extends "zerver/emails/email_base_default.html" %}
|
||||||
|
|
||||||
{% block illustration %}
|
{% block illustration %}
|
||||||
<img src="{{ email_images_base_uri }}/email_logo.png" alt=""/>
|
<img src="{{ email_images_base_url }}/email_logo.png" alt=""/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% extends "zerver/emails/email_base_default.html" %}
|
{% extends "zerver/emails/email_base_default.html" %}
|
||||||
|
|
||||||
{% block illustration %}
|
{% block illustration %}
|
||||||
<img src="{{ email_images_base_uri }}/email_logo.png" alt=""/>
|
<img src="{{ email_images_base_url }}/email_logo.png" alt=""/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% extends "zerver/emails/email_base_default.html" %}
|
{% extends "zerver/emails/email_base_default.html" %}
|
||||||
|
|
||||||
{% block illustration %}
|
{% block illustration %}
|
||||||
<img src="{{ email_images_base_uri }}/email_logo.png" alt=""/>
|
<img src="{{ email_images_base_url }}/email_logo.png" alt=""/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% extends "zerver/emails/email_base_default.html" %}
|
{% extends "zerver/emails/email_base_default.html" %}
|
||||||
|
|
||||||
{% block illustration %}
|
{% block illustration %}
|
||||||
<img src="{{ email_images_base_uri }}/registration_confirmation.png" alt=""/>
|
<img src="{{ email_images_base_url }}/registration_confirmation.png" alt=""/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
|
@ -128,7 +128,7 @@ def build_email(
|
||||||
# Emails use unhashed image URLs so that those continue to
|
# Emails use unhashed image URLs so that those continue to
|
||||||
# work over time, even if the prod-static directory is cleaned
|
# work over time, even if the prod-static directory is cleaned
|
||||||
# out; as such, they just use a STATIC_URL prefix.
|
# out; as such, they just use a STATIC_URL prefix.
|
||||||
"email_images_base_uri": settings.STATIC_URL + "images/emails",
|
"email_images_base_url": settings.STATIC_URL + "images/emails",
|
||||||
"physical_address": settings.PHYSICAL_ADDRESS,
|
"physical_address": settings.PHYSICAL_ADDRESS,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,8 @@ class EmailLogBackEnd(EmailBackend):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def prepare_email_messages_for_forwarding(email_messages: Sequence[EmailMessage]) -> None:
|
def prepare_email_messages_for_forwarding(email_messages: Sequence[EmailMessage]) -> None:
|
||||||
localhost_email_images_base_uri = settings.ROOT_DOMAIN_URI + "/static/images/emails"
|
localhost_email_images_base_url = settings.ROOT_DOMAIN_URI + "/static/images/emails"
|
||||||
czo_email_images_base_uri = "https://chat.zulip.org/static/images/emails"
|
czo_email_images_base_url = "https://chat.zulip.org/static/images/emails"
|
||||||
|
|
||||||
for email_message in email_messages:
|
for email_message in email_messages:
|
||||||
assert isinstance(email_message, EmailMultiAlternatives)
|
assert isinstance(email_message, EmailMultiAlternatives)
|
||||||
|
@ -77,7 +77,7 @@ class EmailLogBackEnd(EmailBackend):
|
||||||
# will be able to fetch the illustrations used in the emails.
|
# will be able to fetch the illustrations used in the emails.
|
||||||
html_alternative = (
|
html_alternative = (
|
||||||
email_message.alternatives[0][0].replace(
|
email_message.alternatives[0][0].replace(
|
||||||
localhost_email_images_base_uri, czo_email_images_base_uri
|
localhost_email_images_base_url, czo_email_images_base_url
|
||||||
),
|
),
|
||||||
email_message.alternatives[0][1],
|
email_message.alternatives[0][1],
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue