Nested folders: Fix moving folder under root (#65684)

* Nested folders: Fix moving folder under root

* Add store test for not empty parent after update

* Modify folder and document store update implementation

Move folder only if NewParentUID is not nil

* Apply suggestion from code review
This commit is contained in:
Sofia Papagiannaki
2023-04-03 21:24:36 +03:00
committed by GitHub
parent ac09372abf
commit a270188f0c
4 changed files with 120 additions and 15 deletions
+5 -1
View File
@@ -543,10 +543,14 @@ func (s *Service) Move(ctx context.Context, cmd *folder.MoveFolderCommand) (*fol
}
}
newParentUID := ""
if cmd.NewParentUID != "" {
newParentUID = cmd.NewParentUID
}
return s.store.Update(ctx, folder.UpdateFolderCommand{
UID: cmd.UID,
OrgID: cmd.OrgID,
NewParentUID: &cmd.NewParentUID,
NewParentUID: &newParentUID,
SignedInUser: cmd.SignedInUser,
})
}