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

@ -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.