From 3c3050c76f86c7a8cc2f217f9305cb1051e0eca0 Mon Sep 17 00:00:00 2001 From: John Molakvoæ Date: Fri, 24 Mar 2023 09:41:40 +0100 Subject: feat(files): implement sorting per view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ --- apps/files/lib/Controller/ViewController.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 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 6047ad81808..cb41dfb300b 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -250,10 +250,8 @@ class ViewController extends Controller { $this->initialState->provideInitialState('config', $this->userConfig->getConfigs()); // File sorting user config - $defaultFileSorting = $this->config->getUserValue($userId, 'files', 'file_sorting', 'basename'); - $defaultFileSortingDirection = $this->config->getUserValue($userId, 'files', 'file_sorting_direction', 'asc'); - $this->initialState->provideInitialState('defaultFileSorting', $defaultFileSorting === 'name' ? 'basename' : $defaultFileSorting); - $this->initialState->provideInitialState('defaultFileSortingDirection', $defaultFileSortingDirection === 'desc' ? 'desc' : 'asc'); + $filesSortingConfig = json_decode($this->config->getUserValue($userId, 'files', 'files_sorting_configs', '{}'), true); + $this->initialState->provideInitialState('filesSortingConfig', $filesSortingConfig); // render the container content for every navigation item foreach ($navItems as $item) { @@ -298,8 +296,8 @@ class ViewController extends Controller { $params['ownerDisplayName'] = $storageInfo['ownerDisplayName'] ?? ''; $params['isPublic'] = false; $params['allowShareWithLink'] = $this->shareManager->shareApiAllowLinks() ? 'yes' : 'no'; - $params['defaultFileSorting'] = $this->config->getUserValue($userId, 'files', 'file_sorting', 'name'); - $params['defaultFileSortingDirection'] = $this->config->getUserValue($userId, 'files', 'file_sorting_direction', 'asc'); + $params['defaultFileSorting'] = $filesSortingConfig['files']['mode'] ?? 'basename'; + $params['defaultFileSortingDirection'] = $filesSortingConfig['files']['direction'] ?? 'asc'; $params['showgridview'] = $this->config->getUserValue($userId, 'files', 'show_grid', false); $showHidden = (bool) $this->config->getUserValue($userId, 'files', 'show_hidden', false); $params['showHiddenFiles'] = $showHidden ? 1 : 0; -- cgit v1.2.3