[PATCH] themes/sourcehut: fix sourcehut theme
Export this patch
With the newer version of `go-imap` some properties got renamed and
sourcehut theme stop working.
---
plugins/base/routes.go | 6 +++---
themes/sourcehut/mailbox.html | 6 +++---
themes/sourcehut/message.html | 10 +++++-----
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/plugins/base/routes.go b/plugins/base/routes.go
index 5176775..31313a2 100644
--- a/plugins/base/routes.go
+++ b/plugins/base/routes.go
@@ -404,7 +404,7 @@ type MessageRenderData struct {
Part *IMAPPartNode
View interface{}
MailboxPage int
- Flags map[string]bool
+ Flags map[imap.Flag]bool
}
func handleGetPart(ctx *alps.Context, raw bool) error {
@@ -488,12 +488,12 @@ func handleGetPart(ctx *alps.Context, raw bool) error {
view = nil
}
- flags := make(map[string]bool)
+ flags := make(map[imap.Flag]bool)
for _, f := range selected.PermanentFlags {
if f == imap.FlagWildcard {
continue
}
- flags[string(f)] = msg.HasFlag(f)
+ flags[f] = msg.HasFlag(f)
}
ibase.BaseRenderData.WithTitle(msg.Envelope.Subject)
diff --git a/themes/sourcehut/mailbox.html b/themes/sourcehut/mailbox.html
index e4bada5..e775b98 100644
--- a/themes/sourcehut/mailbox.html
+++ b/themes/sourcehut/mailbox.html
@@ -60,10 +60,10 @@
</span>
<span class="text-normal from">
{{ range .Envelope.From }}
- {{ if .PersonalName }}
- {{ .PersonalName }}
+ {{ if .Name }}
+ {{ .Name }}
{{ else }}
- {{ .MailboxName }}@{{ .HostName }}
+ {{ .Addr }}
{{ end }}
{{ end }}
</span>
diff --git a/themes/sourcehut/message.html b/themes/sourcehut/message.html
index 077d33c..f107e81 100644
--- a/themes/sourcehut/message.html
+++ b/themes/sourcehut/message.html
@@ -78,8 +78,8 @@
{{define "addr-list"}}
{{range $i, $addr := .}}
{{- if $i}},{{end}}
- {{.PersonalName}}
- <<a href="/compose?to={{.Address}}">{{.Address}}</a>>
+ {{.Name}}
+ <<a href="/compose?to={{.Addr}}">{{.Addr}}</a>>
{{- end}}
{{end}}
@@ -125,7 +125,7 @@
<details>
<summary>Move to another mailbox</summary>
<form method="post" action="/message/{{.Mailbox.Name | pathescape}}/move">
- <input type="hidden" name="uids" value="{{.Message.Uid}}">
+ <input type="hidden" name="uids" value="{{.Message.UID}}">
<div class="form-group">
<select class="form-control" name="to" id="move-to">
{{range .Mailboxes}}
@@ -142,7 +142,7 @@
<details>
<summary>Delete</summary>
<form method="post" action="/message/{{.Mailbox.Name | pathescape}}/delete">
- <input type="hidden" name="uids" value="{{.Message.Uid}}">
+ <input type="hidden" name="uids" value="{{.Message.UID}}">
<p>Are you sure?</p>
<div class="pull-right">
<button class="btn btn-danger">Delete</button>
@@ -154,7 +154,7 @@
<details>
<summary>Edit flags</summary>
<form method="post" action="/message/{{.Mailbox.Name | pathescape}}/flag">
- <input type="hidden" name="uids" value="{{.Message.Uid}}">
+ <input type="hidden" name="uids" value="{{.Message.UID}}">
<div class="form-group">
{{range $name, $has := .Flags}}
{{if ismutableflag $name}}
--
2.42.0
I've split this patch into 2 and pushed them. Thanks!