From aaa30ead41532fa920f3c5e0298ed52196d7fe3a Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 22 Oct 2020 10:32:46 -0400 Subject: [PATCH] Handle \Deleted emails in message list This can happen if an email is deleted by an external client, and this change fixes a template crash in such cases. I elected to display (deleted email) rather than to hide deleted messages so that, if the message is unread, it provides an explanation for your inbox showing $n unread emails where $n > number of non-deleted emails. This partially addresses ~migadu/alps#121 --- themes/alps/assets/style.css | 5 +++++ themes/alps/mailbox.html | 32 ++++++++++++++++++++++++++------ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/themes/alps/assets/style.css b/themes/alps/assets/style.css index f91a271..6d107de 100644 --- a/themes/alps/assets/style.css +++ b/themes/alps/assets/style.css @@ -291,6 +291,11 @@ main.create-update .event-date input { .message-list-unread.message-list-sender, .message-list-unread.message-list-date { color: black;} +.message-list-unread.message-list-subject { + font-weight: normal; + color: #555; +} + .message-list-date { text-align: right; } diff --git a/themes/alps/mailbox.html b/themes/alps/mailbox.html index 0c70385..4582726 100644 --- a/themes/alps/mailbox.html +++ b/themes/alps/mailbox.html @@ -34,19 +34,28 @@
{{range .Messages}} -
+ {{ $classes := "message-list-item" }} + {{ if not (.HasFlag "\\Seen") }} + {{ $classes = printf "%s %s" $classes "message-list-unread" }} + {{ end }} + {{ if (.HasFlag "\\Deleted") }} + {{ $classes = printf "%s %s" $classes "message-list-deleted" }} + {{ end }} + + {{ if not (.HasFlag "\\Deleted") }} +
-
- {{ range .Envelope.From }} +
+ {{ range .Envelope.From }} {{ if .PersonalName }} {{.PersonalName}} {{ else }} {{.MailboxName}}@{{.HostName}} {{ end }} - {{ end }} + {{ end }}
-
+ -
+
{{ .Envelope.Date | formatdate }}
+ {{ else }} +
+ +
+
+
+ (this email was deleted by another client) +
+
+ {{ end }} + {{ end }} {{if not .Messages}}

Nothing here yet.