forked from Silverfish/proton-bridge
Merge branch 'release/congo' into devel
This commit is contained in:
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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.
|
||||
|
||||
Reference in New Issue
Block a user