From 4023f1e582a4020a438ee52e050ce9261b18db28 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sun, 21 Jan 2024 19:52:31 +0100 Subject: fix(files): Make sure to add the `fileid` on favorite folders navigation entries Signed-off-by: Ferdinand Thiessen --- apps/files/lib/Controller/ViewController.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'apps/files/lib/Controller/ViewController.php') diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 7931686c92e..5172194dd8b 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -226,9 +226,14 @@ class ViewController extends Controller { // Get all the user favorites to create a submenu try { - $favElements = $this->activityHelper->getFavoriteFilePaths($userId); + $userFolder = $this->rootFolder->getUserFolder($userId); + $favElements = $this->activityHelper->getFavoriteNodes($userId, true); + $favElements = array_map(fn (Folder $node) => [ + 'fileid' => $node->getId(), + 'path' => $userFolder->getRelativePath($node->getPath()), + ], $favElements); } catch (\RuntimeException $e) { - $favElements['folders'] = []; + $favElements = []; } // If the file doesn't exists in the folder and @@ -260,7 +265,7 @@ class ViewController extends Controller { $this->initialState->provideInitialState('storageStats', $storageInfo); $this->initialState->provideInitialState('config', $this->userConfig->getConfigs()); $this->initialState->provideInitialState('viewConfigs', $this->viewConfig->getConfigs()); - $this->initialState->provideInitialState('favoriteFolders', $favElements['folders'] ?? []); + $this->initialState->provideInitialState('favoriteFolders', $favElements); // File sorting user config $filesSortingConfig = json_decode($this->config->getUserValue($userId, 'files', 'files_sorting_configs', '{}'), true); -- cgit v1.2.3