diff --git a/apps/files/lib/ConfigLexicon.php b/apps/files/lib/ConfigLexicon.php index 30ecb21ca7b72..cdd20d4d8b1e4 100644 --- a/apps/files/lib/ConfigLexicon.php +++ b/apps/files/lib/ConfigLexicon.php @@ -23,6 +23,9 @@ 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 @@ public function getAppConfigs(): array { 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 f642ebb0c2fc9..2d2b0c0102043 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -178,6 +178,10 @@ public function index($dir = '', $view = '', $fileid = null) { $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/tests/Controller/ViewControllerTest.php b/apps/files/tests/Controller/ViewControllerTest.php index ee52a31f57d1e..4eeccfc135ae8 100644 --- a/apps/files/tests/Controller/ViewControllerTest.php +++ b/apps/files/tests/Controller/ViewControllerTest.php @@ -302,11 +302,11 @@ public function testTwoFactorAuthEnabled(): void { 'backup_codes' => true, ]); - $invokedCountProvideInitialState = $this->exactly(10); + $invokedCountProvideInitialState = $this->exactly(13); $this->initialState->expects($invokedCountProvideInitialState) ->method('provideInitialState') ->willReturnCallback(function ($key, $data) use ($invokedCountProvideInitialState): void { - if ($invokedCountProvideInitialState->numberOfInvocations() === 10) { + if ($invokedCountProvideInitialState->numberOfInvocations() === 13) { $this->assertEquals('isTwoFactorEnabled', $key); $this->assertTrue($data); }