Skip to content

Commit

Permalink
Merge branch 'dev/default-timeline' of https://github.com/Murena-SAS/…
Browse files Browse the repository at this point in the history
…memories into Murena-SAS-dev/default-timeline
  • Loading branch information
pulsejet committed Sep 29, 2023
2 parents 2bb0f30 + 269d080 commit 6947ee9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/Controller/OtherController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public function getUserConfig(): Http\Response
return $this->config->getUserValue($uid, Application::APPNAME, $key, $default);
};

$defaultTimelinePath = $this->config->getSystemValue('memories.default_timeline_path', 'EMPTY');

return new JSONResponse([
// general stuff
'version' => $version,
Expand All @@ -98,7 +100,7 @@ public function getUserConfig(): Http\Response
'preview_generator_enabled' => Util::previewGeneratorIsEnabled(),

// general settings
'timeline_path' => $getAppConfig('timelinePath', 'EMPTY'),
'timeline_path' => $getAppConfig('timelinePath', $defaultTimelinePath),
'enable_top_memories' => 'true' === $getAppConfig('enableTopMemories', 'true'),

// viewer settings
Expand Down
3 changes: 3 additions & 0 deletions lib/SystemConfigDefault.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@
// 1080 => 1080p (and so on)
'memories.video_default_quality' => '0',

// Default timeline path for all users; if not set, default is '/Photos'
'memories.default_timeline_path' => 'Photos/',

// Memories only provides an admin interface for these
// https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#previews
'enabledPreviewProviders' => [],
Expand Down
3 changes: 2 additions & 1 deletion lib/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ public static function placesGISType(): int
public static function getTimelinePaths(string $uid): array
{
$config = \OC::$server->get(IConfig::class);
$paths = $config->getUserValue($uid, Application::APPNAME, 'timelinePath', null) ?? 'Photos/';
$defaultTimelinePath = self::getSystemConfig('memories.default_timeline_path');
$paths = $config->getUserValue($uid, Application::APPNAME, 'timelinePath', null) ?? $defaultTimelinePath;

return array_map(static fn ($p) => self::sanitizePath(trim($p)), explode(';', $paths));
}
Expand Down

0 comments on commit 6947ee9

Please sign in to comment.