mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-20 00:56:47 +00:00
GODT-1740: Opt-out All Mail visibility in settings file.
This commit is contained in:
@ -20,6 +20,7 @@ package fakeapi
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/ProtonMail/proton-bridge/v2/pkg/pmapi"
|
||||
)
|
||||
@ -94,9 +95,16 @@ func (api *FakePMAPI) createLabel(_ context.Context, label *pmapi.Label, route s
|
||||
if err := api.checkAndRecordCall(POST, route, &pmapi.LabelReq{Label: label}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// API blocks certain names
|
||||
switch strings.ToLower(label.Name) {
|
||||
case "inbox", "drafts", "trash", "spam", "starred":
|
||||
return nil, fmt.Errorf("Invalid name") //nolint:stylecheck
|
||||
}
|
||||
|
||||
for _, existingLabel := range api.labels {
|
||||
if existingLabel.Name == label.Name {
|
||||
return nil, fmt.Errorf("folder or label %s already exists", label.Name)
|
||||
return nil, fmt.Errorf("A label or folder with this name already exists") //nolint:stylecheck
|
||||
}
|
||||
}
|
||||
prefix := "label"
|
||||
|
||||
Reference in New Issue
Block a user