Skip to content

Commit

Permalink
fix(controller): Merge groupfolders if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
zak39 committed Sep 6, 2024
1 parent d32ecb5 commit 31b4eb1
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/Controller/WorkspaceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 31b4eb1

Please sign in to comment.