Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions apps/files/lib/ConfigLexicon.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
),
];
}

Expand Down
4 changes: 4 additions & 0 deletions apps/files/lib/Controller/ViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions apps/files/tests/Controller/ViewControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Loading