mirror of https://github.com/zulip/zulip.git
email_backends: Inline the construction of html_alternative.
Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
parent
30c26b9510
commit
678c7fdd5f
|
@ -69,16 +69,18 @@ class EmailLogBackEnd(EmailBackend):
|
|||
czo_email_images_base_uri = "https://chat.zulip.org/static/images/emails"
|
||||
|
||||
for email_message in email_messages:
|
||||
html_alternative = list(email_message.alternatives[0])
|
||||
assert isinstance(html_alternative[0], str)
|
||||
assert isinstance(email_message.alternatives[0][0], str)
|
||||
# Here, we replace the email addresses used in development
|
||||
# with chat.zulip.org, so that web email providers like Gmail
|
||||
# will be able to fetch the illustrations used in the emails.
|
||||
html_alternative[0] = html_alternative[0].replace(
|
||||
html_alternative = (
|
||||
email_message.alternatives[0][0].replace(
|
||||
localhost_email_images_base_uri, czo_email_images_base_uri
|
||||
),
|
||||
email_message.alternatives[0][1],
|
||||
)
|
||||
assert isinstance(email_message.alternatives, MutableSequence)
|
||||
email_message.alternatives[0] = tuple(html_alternative)
|
||||
email_message.alternatives[0] = html_alternative
|
||||
|
||||
email_message.to = [get_forward_address()]
|
||||
|
||||
|
|
Loading…
Reference in New Issue