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

@ -5,10 +5,11 @@
package mocks
import (
reflect "reflect"
credentials "github.com/ProtonMail/proton-bridge/internal/bridge/credentials"
pmapi "github.com/ProtonMail/proton-bridge/pkg/pmapi"
gomock "github.com/golang/mock/gomock"
reflect "reflect"
)
// MockConfiger is a mock of Configer interface

View File

@ -5,9 +5,10 @@
package mocks
import (
reflect "reflect"
pmapi "github.com/ProtonMail/proton-bridge/pkg/pmapi"
gomock "github.com/golang/mock/gomock"
reflect "reflect"
)
// MockPanicHandler is a mock of PanicHandler interface

View File

@ -5,9 +5,10 @@
package mocks
import (
gomock "github.com/golang/mock/gomock"
reflect "reflect"
time "time"
gomock "github.com/golang/mock/gomock"
)
// MockListener is a mock of Listener interface

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)