Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

email: Replace `uri` with `url` in templates and backend.

AcKindle34544eb4576b0
diff --git a/docs/subsystems/email.md b/docs/subsystems/email.md
index 3ea819254ab..0c00974a7c6 100644
--- a/docs/subsystems/email.md
+++ b/docs/subsystems/email.md
@@ -105,7 +105,7 @@ email_password = gmail_password
### Notes
- 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
`localhost:9991` aren't allowed by modern email providers). See
`zproject/email_backends.py` for more details.
diff --git a/templates/zerver/emails/confirm_new_email.html b/templates/zerver/emails/confirm_new_email.html
index e755a74e9df..05c52694e48 100644
--- a/templates/zerver/emails/confirm_new_email.html
+++ b/templates/zerver/emails/confirm_new_email.html
@@ -1,7 +1,7 @@
{% extends "zerver/emails/email_base_default.html" %}
{% block illustration %}
-<img src="{{ email_images_base_uri }}/email_logo.png" alt=""/>
+<img src="{{ email_images_base_url }}/email_logo.png" alt=""/>
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/confirm_registration.html b/templates/zerver/emails/confirm_registration.html
index 3ff3cc0b842..e84e9fd6b22 100644
--- a/templates/zerver/emails/confirm_registration.html
+++ b/templates/zerver/emails/confirm_registration.html
@@ -1,7 +1,7 @@
{% extends "zerver/emails/email_base_default.html" %}
{% block illustration %}
-<img src="{{ email_images_base_uri }}/registration_confirmation.png" alt=""/>
+<img src="{{ email_images_base_url }}/registration_confirmation.png" alt=""/>
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/custom_email_base.pre.html b/templates/zerver/emails/custom_email_base.pre.html
index 1a2fdd01cde..9ff778eac12 100644
--- a/templates/zerver/emails/custom_email_base.pre.html
+++ b/templates/zerver/emails/custom_email_base.pre.html
@@ -1,7 +1,7 @@
{% extends "zerver/emails/email_base_marketing.html" %}
{% block illustration %}
-<img src="{{ email_images_base_uri }}/email_logo.png" alt=""/>
+<img src="{{ email_images_base_url }}/email_logo.png" alt=""/>
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/deactivate.html b/templates/zerver/emails/deactivate.html
index e3261dd2ab4..fe86fcdbeec 100644
--- a/templates/zerver/emails/deactivate.html
+++ b/templates/zerver/emails/deactivate.html
@@ -1,7 +1,7 @@
{% extends "zerver/emails/email_base_default.html" %}
{% block illustration %}
-<img src="{{ email_images_base_uri }}/email_logo.png" alt=""/>
+<img src="{{ email_images_base_url }}/email_logo.png" alt=""/>
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/digest.txt b/templates/zerver/emails/digest.txt
index 091ef5feace..c0cf778c789 100644
--- a/templates/zerver/emails/digest.txt
+++ b/templates/zerver/emails/digest.txt
@@ -9,7 +9,7 @@
{{ new_streams.plain|display_list(1000) }}.
{% 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 %}
diff --git a/templates/zerver/emails/email_base_default.html b/templates/zerver/emails/email_base_default.html
index 1e874609a1d..3c8e89464af 100644
--- a/templates/zerver/emails/email_base_default.html
+++ b/templates/zerver/emails/email_base_default.html
@@ -28,7 +28,7 @@
</td>
</tr>
</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>
</tr>
</table>
diff --git a/templates/zerver/emails/email_base_marketing.html b/templates/zerver/emails/email_base_marketing.html
index 47105ac1ea3..f7617c76dab 100644
--- a/templates/zerver/emails/email_base_marketing.html
+++ b/templates/zerver/emails/email_base_marketing.html
@@ -28,7 +28,7 @@
</td>
</tr>
</table>
- <img src="{{ email_images_base_uri }}/footer.png" alt="{{ _('Swimming fish') }}"/>
+ <img src="{{ email_images_base_url }}/footer.png" alt="{{ _('Swimming fish') }}"/>
</td>
</tr>
</table>
diff --git a/templates/zerver/emails/find_team.html b/templates/zerver/emails/find_team.html
index 7e3ffa5624a..6544b176bee 100644
--- a/templates/zerver/emails/find_team.html
+++ b/templates/zerver/emails/find_team.html
@@ -1,7 +1,7 @@
{% extends "zerver/emails/email_base_default.html" %}
{% block illustration %}
-<img src="{{ email_images_base_uri }}/email_logo.png" alt=""/>
+<img src="{{ email_images_base_url }}/email_logo.png" alt=""/>
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/followup_day1.html b/templates/zerver/emails/followup_day1.html
index bf92643a7d0..7418a154c09 100644
--- a/templates/zerver/emails/followup_day1.html
+++ b/templates/zerver/emails/followup_day1.html
@@ -1,7 +1,7 @@
{% extends "zerver/emails/email_base_default.html" %}
{% block illustration %}
-<img src="{{ email_images_base_uri }}/email_logo.png" alt=""/>
+<img src="{{ email_images_base_url }}/email_logo.png" alt=""/>
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/followup_day2.html b/templates/zerver/emails/followup_day2.html
index e7570bcdf2a..ad325de0729 100644
--- a/templates/zerver/emails/followup_day2.html
+++ b/templates/zerver/emails/followup_day2.html
@@ -1,7 +1,7 @@
{% extends "zerver/emails/email_base_default.html" %}
{% block illustration %}
-<img src="{{ email_images_base_uri }}/day2_1.png" alt=""/>
+<img src="{{ email_images_base_url }}/day2_1.png" alt=""/>
{% endblock %}
{% 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…?”") }}
</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>
{% 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 %}
diff --git a/templates/zerver/emails/invitation.html b/templates/zerver/emails/invitation.html
index 15979a59643..35ebb8ab512 100644
--- a/templates/zerver/emails/invitation.html
+++ b/templates/zerver/emails/invitation.html
@@ -1,7 +1,7 @@
{% extends "zerver/emails/email_base_default.html" %}
{% block illustration %}
-<img src="{{ email_images_base_uri }}/registration_confirmation.png" alt=""/>
+<img src="{{ email_images_base_url }}/registration_confirmation.png" alt=""/>
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/invitation_reminder.html b/templates/zerver/emails/invitation_reminder.html
index b5db6553e31..d7f81bd98cd 100644
--- a/templates/zerver/emails/invitation_reminder.html
+++ b/templates/zerver/emails/invitation_reminder.html
@@ -1,7 +1,7 @@
{% extends "zerver/emails/email_base_default.html" %}
{% block illustration %}
-<img src="{{ email_images_base_uri }}/invitation_reminder.png" alt=""/>
+<img src="{{ email_images_base_url }}/invitation_reminder.png" alt=""/>
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/notify_change_in_email.html b/templates/zerver/emails/notify_change_in_email.html
index e60ade2614a..68df468d5b0 100644
--- a/templates/zerver/emails/notify_change_in_email.html
+++ b/templates/zerver/emails/notify_change_in_email.html
@@ -1,7 +1,7 @@
{% extends "zerver/emails/email_base_default.html" %}
{% block illustration %}
-<img src="{{ email_images_base_uri }}/email_logo.png" alt=""/>
+<img src="{{ email_images_base_url }}/email_logo.png" alt=""/>
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/notify_new_login.html b/templates/zerver/emails/notify_new_login.html
index ea4efd35df7..06814a3e546 100644
--- a/templates/zerver/emails/notify_new_login.html
+++ b/templates/zerver/emails/notify_new_login.html
@@ -5,7 +5,7 @@
{% endblock %}
{% block illustration %}
-<img src="{{ email_images_base_uri }}/email_logo.png" alt=""/>
+<img src="{{ email_images_base_url }}/email_logo.png" alt=""/>
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/onboarding_zulip_guide.html b/templates/zerver/emails/onboarding_zulip_guide.html
index b57b7ce8760..00d81175ab9 100644
--- a/templates/zerver/emails/onboarding_zulip_guide.html
+++ b/templates/zerver/emails/onboarding_zulip_guide.html
@@ -1,7 +1,7 @@
{% extends "zerver/emails/email_base_default.html" %}
{% block illustration %}
-<img src="{{ email_images_base_uri }}/email_logo.png" alt=""/>
+<img src="{{ email_images_base_url }}/email_logo.png" alt=""/>
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/password_reset.html b/templates/zerver/emails/password_reset.html
index cca91a5c834..4fc6a011b16 100644
--- a/templates/zerver/emails/password_reset.html
+++ b/templates/zerver/emails/password_reset.html
@@ -1,7 +1,7 @@
{% extends "zerver/emails/email_base_default.html" %}
{% block illustration %}
-<img src="{{ email_images_base_uri }}/email_logo.png" alt=""/>
+<img src="{{ email_images_base_url }}/email_logo.png" alt=""/>
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/realm_auto_downgraded.html b/templates/zerver/emails/realm_auto_downgraded.html
index 8238594d745..85db0398e1b 100644
--- a/templates/zerver/emails/realm_auto_downgraded.html
+++ b/templates/zerver/emails/realm_auto_downgraded.html
@@ -1,7 +1,7 @@
{% extends "zerver/emails/email_base_default.html" %}
{% block illustration %}
-<img src="{{ email_images_base_uri }}/email_logo.png" alt=""/>
+<img src="{{ email_images_base_url }}/email_logo.png" alt=""/>
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/realm_reactivation.html b/templates/zerver/emails/realm_reactivation.html
index de44714a8b8..01e0b91bb8a 100644
--- a/templates/zerver/emails/realm_reactivation.html
+++ b/templates/zerver/emails/realm_reactivation.html
@@ -1,7 +1,7 @@
{% extends "zerver/emails/email_base_default.html" %}
{% block illustration %}
-<img src="{{ email_images_base_uri }}/registration_confirmation.png" alt=""/>
+<img src="{{ email_images_base_url }}/registration_confirmation.png" alt=""/>
{% endblock %}
{% block content %}
diff --git a/zerver/lib/send_email.py b/zerver/lib/send_email.py
index eea18894730..3fcd27a5260 100644
--- a/zerver/lib/send_email.py
+++ b/zerver/lib/send_email.py
@@ -128,7 +128,7 @@ def build_email(
# Emails use unhashed image URLs so that those continue to
# work over time, even if the prod-static directory is cleaned
# 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,
}
diff --git a/zproject/email_backends.py b/zproject/email_backends.py
index 3cc421f7d28..33878ab94c5 100644
--- a/zproject/email_backends.py
+++ b/zproject/email_backends.py
@@ -66,8 +66,8 @@ class EmailLogBackEnd(EmailBackend):
@staticmethod
def prepare_email_messages_for_forwarding(email_messages: Sequence[EmailMessage]) -> None:
- localhost_email_images_base_uri = settings.ROOT_DOMAIN_URI + "/static/images/emails"
- czo_email_images_base_uri = "https://chat.zulip.org/static/images/emails"
+ localhost_email_images_base_url = settings.ROOT_DOMAIN_URI + "/static/images/emails"
+ czo_email_images_base_url = "https://chat.zulip.org/static/images/emails"
for email_message in email_messages:
assert isinstance(email_message, EmailMultiAlternatives)
@@ -77,7 +77,7 @@ class EmailLogBackEnd(EmailBackend):
# will be able to fetch the illustrations used in the emails.
html_alternative = (
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],
)