From 31b4eb17fda8262c8aee3d7947ea683ca9a75c66 Mon Sep 17 00:00:00 2001 From: zak39 Date: Fri, 6 Sep 2024 16:12:23 +0200 Subject: [PATCH] fix(controller): Merge groupfolders if it exists --- lib/Controller/WorkspaceController.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/Controller/WorkspaceController.php b/lib/Controller/WorkspaceController.php index e9a0f2d3b..055e0ef9b 100644 --- a/lib/Controller/WorkspaceController.php +++ b/lib/Controller/WorkspaceController.php @@ -186,15 +186,16 @@ public function findAll(): JSONResponse { $workspaces = $this->workspaceService->getAll(); $spaces = []; foreach ($workspaces as $workspace) { - $space = array_merge( - $this->folderHelper->getFolder( - $workspace['groupfolder_id'], - $this->rootFolder->getRootFolderStorageId() - ), - $workspace + $folderInfo = $this->folderHelper->getFolder( + $workspace['groupfolder_id'], + $this->rootFolder->getRootFolderStorageId() ); + $space = ($folderInfo !== false) ? array_merge( + $folderInfo, + $workspace + ) : $workspace; - $gids = array_keys($space['groups']); + $gids = array_keys($space['groups'] ?? []); $groups = array_map(fn ($gid) => $this->groupManager->get($gid), $gids); $space['groups'] = GroupFormatter::formatGroups($groups);