[v10.3.x] Folders: Fix creating/updating a folder whose title has leading and trailing spaces (#81006)

Folders: Fix creating/updating a folder whose title has leading and trailing spaces (#80909)

* Add tests

* Folders: Fix creating folder whose title has leading and trailing spaces

* Fix folder update

* Remove redundant argument

* Fix test

(cherry picked from commit 4243079cb5)
This commit is contained in:
Sofia Papagiannaki
2024-01-22 20:50:54 +02:00
committed by GitHub
parent c57ba08e28
commit b168ca8a9a
4 changed files with 97 additions and 29 deletions
+3 -3
View File
@@ -56,7 +56,7 @@ func ProvideService(
features featuremgmt.FeatureToggles,
r prometheus.Registerer,
) folder.Service {
store := ProvideStore(db, cfg, features)
store := ProvideStore(db, cfg)
srv := &Service{
cfg: cfg,
log: log.New("folder-service"),
@@ -457,7 +457,7 @@ func (s *Service) Create(ctx context.Context, cmd *folder.CreateFolderCommand) (
// well, but for now we take the UID from the newly created folder.
UID: dash.UID,
OrgID: cmd.OrgID,
Title: cmd.Title,
Title: dashFolder.Title,
Description: cmd.Description,
ParentUID: cmd.ParentUID,
}
@@ -498,7 +498,7 @@ func (s *Service) Update(ctx context.Context, cmd *folder.UpdateFolderCommand) (
if foldr, err = s.store.Update(ctx, folder.UpdateFolderCommand{
UID: cmd.UID,
OrgID: cmd.OrgID,
NewTitle: cmd.NewTitle,
NewTitle: &dashFolder.Title,
NewDescription: cmd.NewDescription,
SignedInUser: user,
}); err != nil {