[PATCH] alps theme: fix nil on emails without a text part
Export this patch
Closes: https://todo.sr.ht/~emersion/alps/100
---
themes/alps/mailbox.html | 2 +-
themes/alps/message.html | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/themes/alps/mailbox.html b/themes/alps/mailbox.html
index 93a45ce..735910d 100644
--- a/themes/alps/mailbox.html
+++ b/themes/alps/mailbox.html
@@ -47,7 +47,7 @@
{{ end }}
</div>
<div class="message-list-subject message-list-item {{ if not (.HasFlag "\\Seen") }}message-list-unread{{ end }}">
- <a href="{{.TextPart.URL false}}">
+ <a href="{{if not .TextPart}} {{.URL}} {{else}} {{.TextPart.URL false}} {{end}}">
{{if .Envelope.Subject}}
{{.Envelope.Subject}}
{{else}}
diff --git a/themes/alps/message.html b/themes/alps/message.html
index 1d74489..2926641 100644
--- a/themes/alps/message.html
+++ b/themes/alps/message.html
@@ -128,10 +128,10 @@
<span class="followups">
{{if .Message.HasFlag "\\Draft"}}
- <a class="action-group button-link" href="{{.Message.URL}}/edit?part={{.Message.TextPart.PathString}}">Edit draft</a>
+ <a class="action-group button-link" href="{{.Message.URL}}/edit{{if .Message.TextPart}}?part={{.Message.TextPart.PathString}}{{end}}">Edit draft</a>
{{else}}
- <a class="action-group button-link" href="{{.Message.URL}}/reply?part={{.Message.TextPart.PathString}}">Reply</a>
- <a class="action-group button-link" href="{{.Message.URL}}/forward?part={{.Message.TextPart.PathString}}">Forward</a>
+ <a class="action-group button-link" href="{{.Message.URL}}/reply{{if .Message.TextPart}}?part={{.Message.TextPart.PathString}}{{end}}">Reply</a>
+ <a class="action-group button-link" href="{{.Message.URL}}/forward{{if .Message.TextPart}}?part={{.Message.TextPart.PathString}}{{end}}">Forward</a>
{{end}}
</span>
</div>
--
2.27.0
Thanks for the patch! LGTM with the spaces in the first link removed,
pushed.