mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 12:46:46 +00:00
fix(GODT-2805): Ignore Contact Group Labels
This commit is contained in:
@ -133,7 +133,7 @@ func toIMAPMessage(message proton.MessageMetadata) imap.Message {
|
||||
|
||||
func WantLabel(label proton.Label) bool {
|
||||
if label.Type != proton.LabelTypeSystem {
|
||||
return true
|
||||
return label.Type != proton.LabelTypeContactGroup
|
||||
}
|
||||
|
||||
// nolint:exhaustive
|
||||
|
||||
@ -38,6 +38,10 @@ func (s *Service) HandleLabelEvents(ctx context.Context, events []proton.LabelEv
|
||||
for _, event := range events {
|
||||
switch event.Action {
|
||||
case proton.EventCreate:
|
||||
if !WantLabel(event.Label) {
|
||||
continue
|
||||
}
|
||||
|
||||
updates := onLabelCreated(ctx, s, event)
|
||||
|
||||
if err := waitOnIMAPUpdates(ctx, updates); err != nil {
|
||||
@ -45,6 +49,10 @@ func (s *Service) HandleLabelEvents(ctx context.Context, events []proton.LabelEv
|
||||
}
|
||||
|
||||
case proton.EventUpdateFlags, proton.EventUpdate:
|
||||
if !WantLabel(event.Label) {
|
||||
continue
|
||||
}
|
||||
|
||||
updates, err := onLabelUpdated(ctx, s, event)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to handle update label event: %w", err)
|
||||
|
||||
@ -191,7 +191,8 @@ func syncLabels(ctx context.Context, labels map[string]proton.Label, connectors
|
||||
}
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown label type: %d", label.Type)
|
||||
logrus.Errorf("Unknown label type: %d", label.Type)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user