From db37880d080d5f8505f72a7ec6607aae25ff8812 Mon Sep 17 00:00:00 2001 From: Daniil Fadeev Date: Thu, 27 Apr 2023 16:50:02 +0700 Subject: [PATCH] emails: Fix some css not being applied to emails. This commit places the email CSS into the `style` tag located in the `head` section. This resolves the issue of being unable to apply certain CSS styles that cannot be inlined, such as media queries and pseudo-classes. --- templates/zerver/emails/email.css | 4 ++-- templates/zerver/emails/email_base_default.html | 2 ++ templates/zerver/emails/email_base_marketing.html | 2 ++ templates/zerver/emails/email_base_messages.html | 2 ++ zerver/lib/send_email.py | 7 +------ 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/templates/zerver/emails/email.css b/templates/zerver/emails/email.css index 073b92fa97..774ddf8ee9 100644 --- a/templates/zerver/emails/email.css +++ b/templates/zerver/emails/email.css @@ -147,8 +147,8 @@ p.digest_paragraph, .sponsorship_request_link:hover, .support_request_link:hover, .email-preferences a:hover, -.missed_message.no_content a:hover { - color: #434388; +.missed_message.no_content-explanation a:hover { + color: #434388 !important; } .important { diff --git a/templates/zerver/emails/email_base_default.html b/templates/zerver/emails/email_base_default.html index 3c8e89464a..d6f37327bf 100644 --- a/templates/zerver/emails/email_base_default.html +++ b/templates/zerver/emails/email_base_default.html @@ -1,10 +1,12 @@ {% import 'zerver/emails/macros.html' as macros %} +{% import 'zerver/emails/email.css' as css_styles %} Zulip + diff --git a/templates/zerver/emails/email_base_marketing.html b/templates/zerver/emails/email_base_marketing.html index f7617c76da..3bad731429 100644 --- a/templates/zerver/emails/email_base_marketing.html +++ b/templates/zerver/emails/email_base_marketing.html @@ -1,10 +1,12 @@ {% import 'zerver/emails/macros.html' as macros %} +{% import 'zerver/emails/email.css' as css_styles %} Zulip +
diff --git a/templates/zerver/emails/email_base_messages.html b/templates/zerver/emails/email_base_messages.html index c93a4469a0..e6e96ee895 100644 --- a/templates/zerver/emails/email_base_messages.html +++ b/templates/zerver/emails/email_base_messages.html @@ -1,8 +1,10 @@ +{% import 'zerver/emails/email.css' as css_styles %} Zulip + {% if has_preheader %} css_inline.CSSInliner: - with open(CSS_SOURCE_PATH) as file: - content = file.read() - return css_inline.CSSInliner(extra_css=content) + return css_inline.CSSInliner() class FromAddress: