Merge branch 'release/congo' into devel

This commit is contained in:
Jakub
2020-09-08 09:37:05 +02:00
286 changed files with 22512 additions and 1057 deletions

View File

@ -5,10 +5,9 @@
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,10 +5,9 @@
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

@ -110,22 +110,14 @@ func (store *Store) leastUsedColor() string {
store.lock.RLock()
defer store.lock.RUnlock()
usage := map[string]int{}
colors := []string{}
for _, a := range store.addresses {
for _, m := range a.mailboxes {
if m.color != "" {
usage[m.color]++
}
colors = append(colors, m.color)
}
}
leastUsed := pmapi.LabelColors[0]
for _, color := range pmapi.LabelColors {
if usage[leastUsed] > usage[color] {
leastUsed = color
}
}
return leastUsed
return pmapi.LeastUsedColor(colors)
}
// updateMailbox updates the mailbox via the API.