Use shorter if syntax
This commit is contained in:
parent
477bfd69a6
commit
5d290410ee
2 changed files with 3 additions and 6 deletions
|
@ -109,12 +109,11 @@ type CategorizedMailboxes struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cc *CategorizedMailboxes) Append(mi MailboxInfo, status *MailboxStatus) {
|
func (cc *CategorizedMailboxes) Append(mi MailboxInfo, status *MailboxStatus) {
|
||||||
name := mi.Name
|
|
||||||
details := &MailboxDetails{
|
details := &MailboxDetails{
|
||||||
Info: &mi,
|
Info: &mi,
|
||||||
Status: status,
|
Status: status,
|
||||||
}
|
}
|
||||||
if name == "INBOX" {
|
if name := mi.Name; name == "INBOX" {
|
||||||
cc.Common.Inbox = details
|
cc.Common.Inbox = details
|
||||||
} else if name == "Drafts" {
|
} else if name == "Drafts" {
|
||||||
cc.Common.Drafts = details
|
cc.Common.Drafts = details
|
||||||
|
@ -194,8 +193,7 @@ func newIMAPBaseRenderData(ctx *alps.Context,
|
||||||
mailboxes[i].Total = int(inbox.Messages)
|
mailboxes[i].Total = int(inbox.Messages)
|
||||||
}
|
}
|
||||||
|
|
||||||
status, _ := subscriptions[mailboxes[i].Name]
|
categorized.Append(mailboxes[i], subscriptions[mailboxes[i].Name])
|
||||||
categorized.Append(mailboxes[i], status)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return &IMAPBaseRenderData{
|
return &IMAPBaseRenderData{
|
||||||
|
|
|
@ -24,8 +24,7 @@ const maxAttachmentSize = 32 << 20 // 32 MiB
|
||||||
|
|
||||||
func generateToken() (string, error) {
|
func generateToken() (string, error) {
|
||||||
b := make([]byte, 32)
|
b := make([]byte, 32)
|
||||||
_, err := rand.Read(b)
|
if _, err := rand.Read(b); err != nil {
|
||||||
if err != nil {
|
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
return base64.URLEncoding.EncodeToString(b), nil
|
return base64.URLEncoding.EncodeToString(b), nil
|
||||||
|
|
Loading…
Reference in a new issue