Skip to content

Commit

Permalink
Merge pull request #1055 from arawa/fix/workspace-inconsistency-crash
Browse files Browse the repository at this point in the history
Merge groupfolders if it exists
  • Loading branch information
zak39 authored Sep 6, 2024
2 parents d32ecb5 + 31b4eb1 commit 960c015
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 960c015

Please sign in to comment.