mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-16 07:06:45 +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 {
|
func WantLabel(label proton.Label) bool {
|
||||||
if label.Type != proton.LabelTypeSystem {
|
if label.Type != proton.LabelTypeSystem {
|
||||||
return true
|
return label.Type != proton.LabelTypeContactGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint:exhaustive
|
// nolint:exhaustive
|
||||||
|
|||||||
@ -38,6 +38,10 @@ func (s *Service) HandleLabelEvents(ctx context.Context, events []proton.LabelEv
|
|||||||
for _, event := range events {
|
for _, event := range events {
|
||||||
switch event.Action {
|
switch event.Action {
|
||||||
case proton.EventCreate:
|
case proton.EventCreate:
|
||||||
|
if !WantLabel(event.Label) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
updates := onLabelCreated(ctx, s, event)
|
updates := onLabelCreated(ctx, s, event)
|
||||||
|
|
||||||
if err := waitOnIMAPUpdates(ctx, updates); err != nil {
|
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:
|
case proton.EventUpdateFlags, proton.EventUpdate:
|
||||||
|
if !WantLabel(event.Label) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
updates, err := onLabelUpdated(ctx, s, event)
|
updates, err := onLabelUpdated(ctx, s, event)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to handle update label event: %w", err)
|
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:
|
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