diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-01-21 19:52:31 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-01-25 15:07:52 +0100 |
commit | 4023f1e582a4020a438ee52e050ce9261b18db28 (patch) | |
tree | a0ffb40587ad6f2bbffcf6e74267acd19825828f /apps/files/lib/Controller | |
parent | 2893d1b926d098a743d226590c3b96987843c6f8 (diff) | |
download | nextcloud-server-4023f1e582a4020a438ee52e050ce9261b18db28.tar.gz nextcloud-server-4023f1e582a4020a438ee52e050ce9261b18db28.zip |
fix(files): Make sure to add the `fileid` on favorite folders navigation entries
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/files/lib/Controller')
-rw-r--r-- | apps/files/lib/Controller/ViewController.php | 11 |
1 files changed, 8 insertions, 3 deletions
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); |