From 81e6a022e6c46748b34728daeef310e2a65c3c5e Mon Sep 17 00:00:00 2001 From: Vishnu Ks Date: Mon, 31 Dec 2018 08:54:59 +0000 Subject: [PATCH] emails: Inline CSS in missed_message. As part of this change, we port into the .messages class the work in 4e8e7348da840d39ae3da900e17505da35fbbcc5 to change overflow-y to auto, not scroll (skipping that would result in a regression). --- templates/zerver/emails/digest.source.html | 2 +- templates/zerver/emails/email.css | 41 ++++++++++++++++++- ...essage.html => missed_message.source.html} | 18 ++++---- tools/check-templates | 2 +- tools/linter_lib/custom_check.py | 1 - 5 files changed, 50 insertions(+), 14 deletions(-) rename templates/zerver/emails/{missed_message.html => missed_message.source.html} (62%) diff --git a/templates/zerver/emails/digest.source.html b/templates/zerver/emails/digest.source.html index a46465e1bf..c9e4c2222f 100644 --- a/templates/zerver/emails/digest.source.html +++ b/templates/zerver/emails/digest.source.html @@ -39,7 +39,7 @@

{% for convo in hot_conversations %} -
+
{% for recipient_block in convo.first_few_messages %}
{{ recipient_block.header.html|safe }}
diff --git a/templates/zerver/emails/email.css b/templates/zerver/emails/email.css index e36d08e5e8..61dee0eca6 100644 --- a/templates/zerver/emails/email.css +++ b/templates/zerver/emails/email.css @@ -213,11 +213,11 @@ a.button:hover { font-weight: normal; } -#messages { +.messages { width: 600px; font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; - overflow-y: scroll; + overflow-y: auto; } .hot_convo_recipient_block { @@ -242,6 +242,43 @@ a.button:hover { padding-top: 1px; } +.recipient_block_with_messages { + background-color: hsl(192, 20%, 95%); + border: 1px solid black; + margin-bottom: 4px; +} + +.recipient_header_with_messages { + background-color: hsl(213, 100%, 81%); + border-bottom: 1px solid black; + font-weight: bold; + padding: 2px; +} + +.message_content_with_messages { + background-color: hsl(192, 20%, 95%); + margin-left: 1px; + margin-right: 2px; +} + +.recipient_block_without_messages { + border: 1px solid black; + margin-bottom: 4px; +} + +.recipient_header_without_messages { + color: hsl(0, 0%, 100%); + background-color: hsl(0, 0%, 27%); + border-bottom: 1px solid black; + font-weight: bold; + padding: 2px; +} + +.message_content_without_messages { + margin-left: 1px; + margin-right: 2px; +} + .hot_convo_message_content_block { padding-left: 6px; font-weight: normal; diff --git a/templates/zerver/emails/missed_message.html b/templates/zerver/emails/missed_message.source.html similarity index 62% rename from templates/zerver/emails/missed_message.html rename to templates/zerver/emails/missed_message.source.html index 5501b66559..67d12999c4 100644 --- a/templates/zerver/emails/missed_message.html +++ b/templates/zerver/emails/missed_message.source.html @@ -18,21 +18,21 @@

{% if show_message_content %} -
+
{% for recipient_block in messages %} {% if not recipient_block.header.stream_message %} -
-
{{ recipient_block.header.html|safe }}
-
+
+
{{ recipient_block.header.html|safe }}
+
{% else %} -
-
{{ recipient_block.header.html|safe }}
-
+
+
{{ recipient_block.header.html|safe }}
+
{% endif %} {% for sender_block in recipient_block.senders %} - {% if sender_block.sender %}
{{ sender_block.sender }}
{% endif %} + {% if sender_block.sender %}
{{ sender_block.sender }}
{% endif %} {% for message_block in sender_block.content %} -
+
{{ message_block.html|safe }}
{% endfor %} diff --git a/tools/check-templates b/tools/check-templates index a91ce57841..54f341d449 100755 --- a/tools/check-templates +++ b/tools/check-templates @@ -17,7 +17,7 @@ EXCLUDED_FILES = [ ## Test data Files for testing modules in tests "tools/tests/test_template_data", # Our parser doesn't handle the way its conditionals are layered - 'templates/zerver/emails/missed_message.html', + 'templates/zerver/emails/missed_message.source.html', ] def check_our_files(modified_only, all_dups, targets): diff --git a/tools/linter_lib/custom_check.py b/tools/linter_lib/custom_check.py index 4262ded376..214a74c3ad 100644 --- a/tools/linter_lib/custom_check.py +++ b/tools/linter_lib/custom_check.py @@ -801,7 +801,6 @@ def build_custom_checkers(by_lang): # Old-style email templates need to use inline style # attributes; it should be possible to clean these up # when we convert these templates to use premailer. - 'templates/zerver/emails/missed_message.html', 'templates/zerver/emails/email_base_messages.html', # Email log templates; should clean up.