mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 20:56:51 +00:00
GODT-2223: Fix handling deletion of nonexistent labels
This commit is contained in:
committed by
Leander Beernaert
parent
849c8bee78
commit
b63029054d
@ -52,9 +52,8 @@ type UserLabelDeleted struct {
|
||||
|
||||
UserID string
|
||||
LabelID string
|
||||
Name string
|
||||
}
|
||||
|
||||
func (event UserLabelDeleted) String() string {
|
||||
return fmt.Sprintf("UserLabelDeleted: UserID: %s, LabelID: %s, Name: %s", event.UserID, event.LabelID, logging.Sensitive(event.Name))
|
||||
return fmt.Sprintf("UserLabelDeleted: UserID: %s, LabelID: %s", event.UserID, event.LabelID)
|
||||
}
|
||||
|
||||
@ -393,21 +393,17 @@ func (user *User) handleDeleteLabelEvent(ctx context.Context, event proton.Label
|
||||
|
||||
user.log.WithField("labelID", event.ID).Info("Handling label deleted event")
|
||||
|
||||
label, ok := user.apiLabels[event.ID]
|
||||
if !ok {
|
||||
delete(user.apiLabels, event.ID)
|
||||
}
|
||||
|
||||
for _, updateCh := range xslices.Unique(maps.Values(user.updateCh)) {
|
||||
update := imap.NewMailboxDeleted(imap.MailboxID(event.ID))
|
||||
updateCh.Enqueue(update)
|
||||
updates = append(updates, update)
|
||||
}
|
||||
|
||||
delete(user.apiLabels, event.ID)
|
||||
|
||||
user.eventCh.Enqueue(events.UserLabelDeleted{
|
||||
UserID: user.apiUser.ID,
|
||||
LabelID: event.ID,
|
||||
Name: label.Name,
|
||||
})
|
||||
|
||||
return updates, nil
|
||||
|
||||
Reference in New Issue
Block a user