fix: missing messages after changing primary address

This commit is contained in:
James Houlahan
2020-05-06 10:34:32 +02:00
parent 2d200f6f8c
commit 4b2977041a
11 changed files with 62 additions and 18 deletions

View File

@ -46,6 +46,8 @@ func (store *Store) RebuildMailboxes() (err error) {
log.WithField("user", store.UserID()).Trace("Truncating mailboxes")
store.addresses = nil
if err = store.truncateMailboxesBucket(); err != nil {
log.WithError(err).Error("Could not truncate mailboxes bucket")
return
@ -127,7 +129,12 @@ func (store *Store) createOrDeleteAddressesEvent() (err error) {
delete(store.addresses, addr.addressID)
}
return err
if err = store.truncateMailboxesBucket(); err != nil {
log.WithError(err).Error("Could not truncate mailboxes bucket")
return
}
return store.initMailboxesBucket()
}
// truncateAddressInfoBucket removes the address info bucket.
@ -153,8 +160,6 @@ func (store *Store) truncateAddressInfoBucket() (err error) {
func (store *Store) truncateMailboxesBucket() (err error) {
log.Trace("Truncating mailboxes bucket")
store.addresses = nil
tx := func(tx *bolt.Tx) (err error) {
mbs := tx.Bucket(mailboxesBucket)