mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Merge pull request #58908 from nextcloud/feat/1701/recent-files-img-grouping
feat(recent-files): allow configuring image grouping
This commit is contained in:
commit
8598f8b171
3 changed files with 30 additions and 2 deletions
|
|
@ -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,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -302,11 +302,11 @@ class ViewControllerTest extends TestCase {
|
|||
'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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue