Fix mailbox view when empty
This fixes the second part of #14. References: https://todo.sr.ht/~sircmpwn/koushin/14
This commit is contained in:
parent
b7be271560
commit
b386d1c2bb
2 changed files with 15 additions and 9 deletions
4
imap.go
4
imap.go
|
@ -216,7 +216,9 @@ func listMessages(conn *imapclient.Client, mboxName string) ([]imapMessage, erro
|
|||
mbox := conn.Mailbox()
|
||||
from := uint32(1)
|
||||
to := mbox.Messages
|
||||
if mbox.Messages > n {
|
||||
if mbox.Messages == 0 {
|
||||
return nil, nil
|
||||
} else if mbox.Messages > n {
|
||||
from = mbox.Messages - n
|
||||
}
|
||||
seqSet := new(imap.SeqSet)
|
||||
|
|
|
@ -15,13 +15,17 @@
|
|||
{{end}}
|
||||
</ul>
|
||||
|
||||
<p>Messages:</p>
|
||||
<ul>
|
||||
{{range .Messages}}
|
||||
<li><a href="/message/{{$.Mailbox.Name | pathescape}}/{{.Uid}}?part={{.TextPartName}}">
|
||||
{{.Envelope.Subject}}
|
||||
</a></li>
|
||||
{{end}}
|
||||
</ul>
|
||||
{{if .Messages}}
|
||||
<p>Messages:</p>
|
||||
<ul>
|
||||
{{range .Messages}}
|
||||
<li><a href="/message/{{$.Mailbox.Name | pathescape}}/{{.Uid}}?part={{.TextPartName}}">
|
||||
{{.Envelope.Subject}}
|
||||
</a></li>
|
||||
{{end}}
|
||||
</ul>
|
||||
{{else}}
|
||||
<p>Mailbox is empty.</p>
|
||||
{{end}}
|
||||
|
||||
{{template "foot"}}
|
||||
|
|
Loading…
Reference in a new issue