diff options
-rw-r--r-- | apps/files/lib/Service/UserConfig.php | 8 | ||||
-rw-r--r-- | apps/files/src/views/Settings.vue | 5 | ||||
-rw-r--r-- | apps/files/src/views/folderTree.ts | 6 |
3 files changed, 18 insertions, 1 deletions
diff --git a/apps/files/lib/Service/UserConfig.php b/apps/files/lib/Service/UserConfig.php index b9b9248e172..c2339965793 100644 --- a/apps/files/lib/Service/UserConfig.php +++ b/apps/files/lib/Service/UserConfig.php @@ -42,6 +42,12 @@ class UserConfig { 'default' => false, 'allowed' => [true, false], ], + [ + // Whether to show the folder tree + 'key' => 'folder_tree', + 'default' => true, + 'allowed' => [true, false], + ], ]; protected IConfig $config; @@ -108,7 +114,7 @@ class UserConfig { if (!in_array($key, $this->getAllowedConfigKeys())) { throw new \InvalidArgumentException('Unknown config key'); } - + if (!in_array($value, $this->getAllowedConfigValues($key))) { throw new \InvalidArgumentException('Invalid config value'); } diff --git a/apps/files/src/views/Settings.vue b/apps/files/src/views/Settings.vue index b5d85b60729..c64f3b898b2 100644 --- a/apps/files/src/views/Settings.vue +++ b/apps/files/src/views/Settings.vue @@ -35,6 +35,11 @@ @update:checked="setConfig('grid_view', $event)"> {{ t('files', 'Enable the grid view') }} </NcCheckboxRadioSwitch> + <NcCheckboxRadioSwitch data-cy-files-settings-setting="folder_tree" + :checked="userConfig.folder_tree" + @update:checked="setConfig('folder_tree', $event)"> + {{ t('files', 'Enable folder tree') }} + </NcCheckboxRadioSwitch> </NcAppSettingsSection> <!-- Settings API--> diff --git a/apps/files/src/views/folderTree.ts b/apps/files/src/views/folderTree.ts index 85c69e5ac94..a466a838f66 100644 --- a/apps/files/src/views/folderTree.ts +++ b/apps/files/src/views/folderTree.ts @@ -9,6 +9,7 @@ import { Folder, Node, View, getNavigation } from '@nextcloud/files' import { translate as t } from '@nextcloud/l10n' import { subscribe } from '@nextcloud/event-bus' import { isSamePath } from '@nextcloud/paths' +import { loadState } from '@nextcloud/initial-state' import FolderSvg from '@mdi/svg/svg/folder.svg?raw' import FolderMultipleSvg from '@mdi/svg/svg/folder-multiple.svg?raw' @@ -24,6 +25,8 @@ import { sourceRoot, } from '../services/FolderTree.ts' +const isFolderTreeEnabled = loadState('files', 'config', { folder_tree: true }).folder_tree + const Navigation = getNavigation() const registerTreeNodeView = (node: TreeNode) => { @@ -142,6 +145,9 @@ const registerFolderTreeChildren = async () => { } export const registerFolderTreeView = async () => { + if (!isFolderTreeEnabled) { + return + } registerFolderTreeRoot() await registerFolderTreeChildren() } |