aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2020-10-22 10:32:46 -0400
committerDrew DeVault <sir@cmpwn.com>2020-10-22 10:40:29 -0400
commitaaa30ead41532fa920f3c5e0298ed52196d7fe3a (patch)
treee6fff4f451f00b072f0f526d73807119d52d953a
parentc20df8da30e80423b3558023c2848eb6cc78fcda (diff)
downloadalps-aaa30ead41532fa920f3c5e0298ed52196d7fe3a.tar.gz
alps-aaa30ead41532fa920f3c5e0298ed52196d7fe3a.zip
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
-rw-r--r--themes/alps/assets/style.css5
-rw-r--r--themes/alps/mailbox.html32
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 @@
<section class="messages">
<div class="message-grid">
{{range .Messages}}
- <div class="message-list-checkbox message-list-item {{ if not (.HasFlag "\\Seen") }}message-list-unread{{ end }}">
+ {{ $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") }}
+ <div class="message-list-checkbox {{$classes}}">
<input type="checkbox" name="uids" value="{{.Uid}}" form="messages-form">
</div>
- <div class="message-list-sender message-list-item {{ if not (.HasFlag "\\Seen") }}message-list-unread{{ end }}">
- {{ range .Envelope.From }}
+ <div class="message-list-sender {{$classes}}">
+ {{ range .Envelope.From }}
{{ if .PersonalName }}
{{.PersonalName}}
{{ else }}
{{.MailboxName}}@{{.HostName}}
{{ end }}
- {{ end }}
+ {{ end }}
</div>
- <div class="message-list-subject message-list-item {{ if not (.HasFlag "\\Seen") }}message-list-unread{{ end }}">
+ <div class="message-list-subject {{$classes}}">
<a href="{{if .TextPart}}{{.TextPart.URL false}}{{else}}{{.URL}}{{end}}">
{{if .Envelope.Subject}}
{{.Envelope.Subject}}
@@ -55,9 +64,20 @@
{{end}}
</a>
</div>
- <div class="message-list-date message-list-item {{ if not (.HasFlag "\\Seen") }}message-list-unread{{ end }}">
+ <div class="message-list-date {{$classes}}">
{{ .Envelope.Date | formatdate }}
</div>
+ {{ else }}
+ <div class="message-list-checkbox {{$classes}}">
+ <input type="checkbox" form="messages-form" disabled readonly>
+ </div>
+ <div class="message-list-sender {{$classes}}"></div>
+ <div class="message-list-subject {{$classes}}">
+ <em>(this email was deleted by another client)</em>
+ </div>
+ <div class="message-list-date {{$classes}}"></div>
+ {{ end }}
+
{{ end }}
{{if not .Messages}}
<p class="empty-list">Nothing here yet.</p>