diff --git a/apps/files/lib/ConfigLexicon.php b/apps/files/lib/ConfigLexicon.php index 30ecb21ca7b..cdd20d4d8b1 100644 --- a/apps/files/lib/ConfigLexicon.php +++ b/apps/files/lib/ConfigLexicon.php @@ -23,6 +23,9 @@ use OCP\Config\ValueType; class ConfigLexicon implements ILexicon { public const OVERWRITES_HOME_FOLDERS = 'overwrites_home_folders'; public const RECENT_LIMIT = 'recent_limit'; + public const GROUP_RECENT_FILES = 'group_recent_files'; + public const RECENT_FILES_GROUP_MIME_TYPES = 'recent_files_group_mime_types'; + public const RECENT_FILES_GROUP_TIMESPAN_MINUTES = 'recent_files_group_timespan_minutes'; public function getStrictness(): Strictness { return Strictness::IGNORE; @@ -45,6 +48,27 @@ class ConfigLexicon implements ILexicon { definition: 'Maximum number of files to display on recent files view', lazy: false, ), + new Entry( + self::GROUP_RECENT_FILES, + ValueType::BOOL, + defaultRaw: false, + definition: 'Whether to group recent files by MIME type or not', + lazy: false, + ), + new Entry( + self::RECENT_FILES_GROUP_MIME_TYPES, + ValueType::ARRAY, + defaultRaw: [], + definition: 'Which MIME types to group in the recent files list', + lazy: false, + ), + new Entry( + self::RECENT_FILES_GROUP_TIMESPAN_MINUTES, + ValueType::INT, + defaultRaw: 2, + definition: 'Time window in minutes to group files uploaded close together in the recent files list', + lazy: false, + ), ]; } diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php index 96ed16464fe..d9a5b24b641 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -178,6 +178,10 @@ class ViewController extends Controller { $this->initialState->provideInitialState('config', $this->userConfig->getConfigs()); $this->initialState->provideInitialState('viewConfigs', $this->viewConfig->getConfigs()); $this->initialState->provideInitialState('recent_limit', $this->appConfig->getAppValueInt(ConfigLexicon::RECENT_LIMIT, 100)); + // Not yet consumed by the frontend, provided for future implementation + $this->initialState->provideInitialState('group_recent_files', $this->appConfig->getAppValueBool(ConfigLexicon::GROUP_RECENT_FILES, false)); + $this->initialState->provideInitialState('recent_files_group_mime_types', $this->appConfig->getAppValueArray(ConfigLexicon::RECENT_FILES_GROUP_MIME_TYPES, [])); + $this->initialState->provideInitialState('recent_files_group_timespan_minutes', $this->appConfig->getAppValueInt(ConfigLexicon::RECENT_FILES_GROUP_TIMESPAN_MINUTES, 2)); // File sorting user config $filesSortingConfig = json_decode($this->config->getUserValue($userId, 'files', 'files_sorting_configs', '{}'), true); diff --git a/apps/files/lib/Service/UserConfig.php b/apps/files/lib/Service/UserConfig.php index 106199fd7fe..dcf30b7796d 100644 --- a/apps/files/lib/Service/UserConfig.php +++ b/apps/files/lib/Service/UserConfig.php @@ -79,33 +79,6 @@ class UserConfig { 'default' => true, 'allowed' => [true, false], ], - [ - // Whether to group images on recent files list or not - 'key' => 'group_recent_files_images', - 'default' => false, - 'allowed' => [true, false], - ], - [ - // Which image mime types to group in the recent files list - 'key' => 'recent_files_group_mimetypes', - 'default' => '', - 'allowed' => [ - 'image/png', - 'image/jpeg', - 'image/gif', - 'image/webp', - 'image/avif', - 'image/heic', - 'image/heif', - ] - ], - [ - // Time window in minutes to group files uploaded close together in the recent files list - 'key' => 'recent_files_group_timespan_minutes', - 'default' => 2, - 'min' => 1, - 'max' => 999, - ], ]; protected ?IUser $user = null; @@ -145,7 +118,7 @@ class UserConfig { * Get the default config value for a given key * * @param string $key a valid config key - * @return string|bool|int + * @return string|bool */ private function getDefaultConfigValue(string $key) { foreach (self::ALLOWED_CONFIGS as $config) { @@ -173,25 +146,7 @@ class UserConfig { throw new \InvalidArgumentException('Unknown config key'); } - if (is_string($value) && str_starts_with($value, '[') && str_ends_with($value, ']')) { - $value = json_decode($value, true) ?? $value; - } - - $config = $this->getConfigDefinition($key); - - if (isset($config['min'], $config['max'])) { - if ((int)$value < $config['min'] || (int)$value > $config['max']) { - throw new \InvalidArgumentException('Invalid config value'); - } - } elseif (is_array($value)) { - $allowedValues = $this->getAllowedConfigValues($key); - foreach ($value as $v) { - if (!in_array($v, $allowedValues)) { - throw new \InvalidArgumentException('Invalid config value'); - } - } - $value = json_encode($value); - } elseif (!in_array($value, $this->getAllowedConfigValues($key))) { + if (!in_array($value, $this->getAllowedConfigValues($key))) { throw new \InvalidArgumentException('Invalid config value'); } @@ -219,27 +174,9 @@ class UserConfig { if (is_bool($this->getDefaultConfigValue($key)) && is_string($value)) { return $value === '1'; } - if (is_string($value) && str_starts_with($value, '[') && str_ends_with($value, ']')) { - $value = json_decode($value, true) ?? $value; - } return $value; }, $this->getAllowedConfigKeys()); return array_combine($this->getAllowedConfigKeys(), $userConfigs); } - - /** - * Get the config definition for a given key - * - * @param string $key - * @return array - */ - private function getConfigDefinition(string $key): array { - foreach (self::ALLOWED_CONFIGS as $config) { - if ($config['key'] === $key) { - return $config; - } - } - return []; - } } diff --git a/apps/files/src/components/FileEntryImageGroup.vue b/apps/files/src/components/FileEntryImageGroup.vue deleted file mode 100644 index 8d25733e829..00000000000 --- a/apps/files/src/components/FileEntryImageGroup.vue +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - diff --git a/apps/files/src/components/FileEntryWrapper.vue b/apps/files/src/components/FileEntryWrapper.vue deleted file mode 100644 index 3e1ceadb591..00000000000 --- a/apps/files/src/components/FileEntryWrapper.vue +++ /dev/null @@ -1,92 +0,0 @@ - - - - - diff --git a/apps/files/src/components/FilesAppSettings/FilesAppSettingsRecent.vue b/apps/files/src/components/FilesAppSettings/FilesAppSettingsRecent.vue deleted file mode 100644 index c7a06d8c3f1..00000000000 --- a/apps/files/src/components/FilesAppSettings/FilesAppSettingsRecent.vue +++ /dev/null @@ -1,69 +0,0 @@ - - - - - diff --git a/apps/files/src/components/FilesListVirtual.vue b/apps/files/src/components/FilesListVirtual.vue index 7c9971749bc..256f9361ec0 100644 --- a/apps/files/src/components/FilesListVirtual.vue +++ b/apps/files/src/components/FilesListVirtual.vue @@ -2,23 +2,20 @@ - SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors - SPDX-License-Identifier: AGPL-3.0-or-later --> - @@ -47,9 +44,9 @@ @@ -61,10 +58,10 @@ @@ -74,17 +71,15 @@