aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/lib/Controller/ViewController.php
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2023-03-24 09:41:40 +0100
committerJohn Molakvoæ <skjnldsv@protonmail.com>2023-04-06 14:49:31 +0200
commit3c3050c76f86c7a8cc2f217f9305cb1051e0eca0 (patch)
treed9656a549b1db4c7f3d37549713a6c96da616464 /apps/files/lib/Controller/ViewController.php
parent0b4da6117fff4d999cb492503a8b6fc04eb75f9d (diff)
downloadnextcloud-server-3c3050c76f86c7a8cc2f217f9305cb1051e0eca0.tar.gz
nextcloud-server-3c3050c76f86c7a8cc2f217f9305cb1051e0eca0.zip
feat(files): implement sorting per view
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files/lib/Controller/ViewController.php')
-rw-r--r--apps/files/lib/Controller/ViewController.php10
1 files changed, 4 insertions, 6 deletions
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;