From 4544eb4576b0f1244916be66ffe609ad4f71965a Mon Sep 17 00:00:00 2001
From: AcKindle3
Date: Tue, 25 Apr 2023 19:47:00 -0400
Subject: [PATCH] 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.
---
docs/subsystems/email.md | 2 +-
templates/zerver/emails/confirm_new_email.html | 2 +-
templates/zerver/emails/confirm_registration.html | 2 +-
templates/zerver/emails/custom_email_base.pre.html | 2 +-
templates/zerver/emails/deactivate.html | 2 +-
templates/zerver/emails/digest.txt | 2 +-
templates/zerver/emails/email_base_default.html | 2 +-
templates/zerver/emails/email_base_marketing.html | 2 +-
templates/zerver/emails/find_team.html | 2 +-
templates/zerver/emails/followup_day1.html | 2 +-
templates/zerver/emails/followup_day2.html | 4 ++--
templates/zerver/emails/invitation.html | 2 +-
templates/zerver/emails/invitation_reminder.html | 2 +-
templates/zerver/emails/notify_change_in_email.html | 2 +-
templates/zerver/emails/notify_new_login.html | 2 +-
templates/zerver/emails/onboarding_zulip_guide.html | 2 +-
templates/zerver/emails/password_reset.html | 2 +-
templates/zerver/emails/realm_auto_downgraded.html | 2 +-
templates/zerver/emails/realm_reactivation.html | 2 +-
zerver/lib/send_email.py | 2 +-
zproject/email_backends.py | 6 +++---
21 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/docs/subsystems/email.md b/docs/subsystems/email.md
index 3ea819254a..0c00974a7c 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 e755a74e9d..05c52694e4 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 %}
-
+
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/confirm_registration.html b/templates/zerver/emails/confirm_registration.html
index 3ff3cc0b84..e84e9fd6b2 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 %}
-
+
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/custom_email_base.pre.html b/templates/zerver/emails/custom_email_base.pre.html
index 1a2fdd01cd..9ff778eac1 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 %}
-
+
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/deactivate.html b/templates/zerver/emails/deactivate.html
index e3261dd2ab..fe86fcdbee 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 %}
-
+
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/digest.txt b/templates/zerver/emails/digest.txt
index 091ef5feac..c0cf778c78 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 1e874609a1..3c8e89464a 100644
--- a/templates/zerver/emails/email_base_default.html
+++ b/templates/zerver/emails/email_base_default.html
@@ -28,7 +28,7 @@
-
+
diff --git a/templates/zerver/emails/email_base_marketing.html b/templates/zerver/emails/email_base_marketing.html
index 47105ac1ea..f7617c76da 100644
--- a/templates/zerver/emails/email_base_marketing.html
+++ b/templates/zerver/emails/email_base_marketing.html
@@ -28,7 +28,7 @@
-
+
diff --git a/templates/zerver/emails/find_team.html b/templates/zerver/emails/find_team.html
index 7e3ffa5624..6544b176be 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 %}
-
+
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/followup_day1.html b/templates/zerver/emails/followup_day1.html
index bf92643a7d..7418a154c0 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 %}
-
+
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/followup_day2.html b/templates/zerver/emails/followup_day2.html
index e7570bcdf2..ad325de072 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 %}
-
+
{% 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…?”") }}
-
+
{% trans %}Don't stress about picking the perfect name for your topic. If anything is out of place, it's easy to move messages, rename topics, or even move a topic to a different stream.{% endtrans %}
diff --git a/templates/zerver/emails/invitation.html b/templates/zerver/emails/invitation.html
index 15979a5964..35ebb8ab51 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 %}
-
+
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/invitation_reminder.html b/templates/zerver/emails/invitation_reminder.html
index b5db6553e3..d7f81bd98c 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 %}
-
+
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/notify_change_in_email.html b/templates/zerver/emails/notify_change_in_email.html
index e60ade2614..68df468d5b 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 %}
-
+
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/notify_new_login.html b/templates/zerver/emails/notify_new_login.html
index ea4efd35df..06814a3e54 100644
--- a/templates/zerver/emails/notify_new_login.html
+++ b/templates/zerver/emails/notify_new_login.html
@@ -5,7 +5,7 @@
{% endblock %}
{% block illustration %}
-
+
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/onboarding_zulip_guide.html b/templates/zerver/emails/onboarding_zulip_guide.html
index b57b7ce876..00d81175ab 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 %}
-
+
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/password_reset.html b/templates/zerver/emails/password_reset.html
index cca91a5c83..4fc6a011b1 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 %}
-
+
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/realm_auto_downgraded.html b/templates/zerver/emails/realm_auto_downgraded.html
index 8238594d74..85db0398e1 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 %}
-
+
{% endblock %}
{% block content %}
diff --git a/templates/zerver/emails/realm_reactivation.html b/templates/zerver/emails/realm_reactivation.html
index de44714a8b..01e0b91bb8 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 %}
-
+
{% endblock %}
{% block content %}
diff --git a/zerver/lib/send_email.py b/zerver/lib/send_email.py
index eea1889473..3fcd27a526 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 3cc421f7d2..33878ab94c 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],
)