Skip to content

Commit 99f9eb4

Browse files
committed
Minor cleanup: use the ModSeq from the Mailbox in a ChangeMailboxAdd, no need to add the ModSeq again
1 parent 9ca50ab commit 99f9eb4

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

store/account.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ func (mb Mailbox) ChangeKeywords() ChangeMailboxKeywords {
317317
}
318318

319319
func (mb Mailbox) ChangeAddMailbox(flags []string) ChangeAddMailbox {
320-
return ChangeAddMailbox{Mailbox: mb, Flags: flags, ModSeq: mb.ModSeq}
320+
return ChangeAddMailbox{Mailbox: mb, Flags: flags}
321321
}
322322

323323
func (mb Mailbox) ChangeRemoveMailbox() ChangeRemoveMailbox {
@@ -2587,7 +2587,7 @@ func (a *Account) MailboxEnsure(tx *bstore.Tx, name string, subscribe bool, spec
25872587
return Mailbox{}, nil, fmt.Errorf("looking up subscription for %q: %v", p, err)
25882588
}
25892589

2590-
changes = append(changes, ChangeAddMailbox{mb, flags, *modseq})
2590+
changes = append(changes, ChangeAddMailbox{mb, flags})
25912591
}
25922592

25932593
// Clear any special-use flags from existing mailboxes and assign them to this mailbox.
@@ -3636,7 +3636,7 @@ func (a *Account) MailboxRename(tx *bstore.Tx, mbsrc *Mailbox, dst string, modse
36363636
} else if err != bstore.ErrAbsent {
36373637
return nil, false, false, fmt.Errorf("look up subscription for new parent %q: %v", parent.Name, err)
36383638
}
3639-
parentChanges = append(parentChanges, ChangeAddMailbox{parent, flags, *modseq})
3639+
parentChanges = append(parentChanges, ChangeAddMailbox{parent, flags})
36403640
}
36413641

36423642
mbsrc.ParentID = parent.ID

store/state.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,8 @@ func (c ChangeRemoveMailbox) ChangeModSeq() ModSeq { return c.ModSeq }
9494

9595
// ChangeAddMailbox is sent for a newly created mailbox.
9696
type ChangeAddMailbox struct {
97-
Mailbox Mailbox
98-
Flags []string // For flags like \Subscribed.
99-
ModSeq ModSeq
97+
Mailbox
98+
Flags []string // For flags like \Subscribed.
10099
}
101100

102101
func (c ChangeAddMailbox) ChangeModSeq() ModSeq { return c.ModSeq }

webaccount/import.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ func importMessages(ctx context.Context, log mlog.Log, token string, acc *store.
485485
err := tx.Insert(&store.Subscription{Name: p})
486486
ximportcheckf(err, "subscribing to imported mailbox")
487487
}
488-
changes = append(changes, store.ChangeAddMailbox{Mailbox: *mb, Flags: []string{`\Subscribed`}, ModSeq: modseq})
488+
changes = append(changes, store.ChangeAddMailbox{Mailbox: *mb, Flags: []string{`\Subscribed`}})
489489
}
490490
if prevMailbox != "" && mb.Name != prevMailbox {
491491
sendEvent("count", importCount{prevMailbox, messages[prevMailbox]})

0 commit comments

Comments
 (0)