diff options
author | Drew DeVault <sir@cmpwn.com> | 2020-10-22 10:32:46 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2020-10-22 10:40:29 -0400 |
commit | aaa30ead41532fa920f3c5e0298ed52196d7fe3a (patch) | |
tree | e6fff4f451f00b072f0f526d73807119d52d953a /themes/alps/mailbox.html | |
parent | c20df8da30e80423b3558023c2848eb6cc78fcda (diff) | |
download | alps-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
Diffstat (limited to 'themes/alps/mailbox.html')
-rw-r--r-- | themes/alps/mailbox.html | 32 |
1 files changed, 26 insertions, 6 deletions
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> |