diff options
author | John Molakvoæ <skjnldsv@protonmail.com> | 2023-03-21 09:53:31 +0100 |
---|---|---|
committer | John Molakvoæ <skjnldsv@protonmail.com> | 2023-04-06 14:49:30 +0200 |
commit | 10010fc532a02958804667e1cb3acee8e9556394 (patch) | |
tree | bbb99c171e6e32b85b5aee9365ad5e9ebe68054e /apps/files/lib | |
parent | b761039cf1946cb64898b9117d1b15dd89080451 (diff) | |
download | nextcloud-server-10010fc532a02958804667e1cb3acee8e9556394.tar.gz nextcloud-server-10010fc532a02958804667e1cb3acee8e9556394.zip |
feat(files): sorting
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files/lib')
-rw-r--r-- | apps/files/lib/Controller/ApiController.php | 2 | ||||
-rw-r--r-- | apps/files/lib/Controller/ViewController.php | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/apps/files/lib/Controller/ApiController.php b/apps/files/lib/Controller/ApiController.php index 85507132edd..c7da9b2c118 100644 --- a/apps/files/lib/Controller/ApiController.php +++ b/apps/files/lib/Controller/ApiController.php @@ -285,7 +285,7 @@ class ApiController extends Controller { * @throws \OCP\PreConditionNotMetException */ public function updateFileSorting($mode, $direction) { - $allowedMode = ['name', 'size', 'mtime']; + $allowedMode = ['basename', 'size', 'mtime']; $allowedDirection = ['asc', 'desc']; if (!in_array($mode, $allowedMode) || !in_array($direction, $allowedDirection)) { $response = new Response(); diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 5133661d725..6047ad81808 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -249,6 +249,12 @@ class ViewController extends Controller { $this->initialState->provideInitialState('navigation', $navItems); $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'); + // render the container content for every navigation item foreach ($navItems as $item) { $content = ''; |