Refactor PR

pull/837/head
Varun Patil 2023-09-29 11:00:44 -07:00
parent 6947ee9bc5
commit 630a435dea
5 changed files with 14 additions and 11 deletions

View File

@ -81,8 +81,6 @@ class OtherController extends GenericApiController
return $this->config->getUserValue($uid, Application::APPNAME, $key, $default); return $this->config->getUserValue($uid, Application::APPNAME, $key, $default);
}; };
$defaultTimelinePath = $this->config->getSystemValue('memories.default_timeline_path', 'EMPTY');
return new JSONResponse([ return new JSONResponse([
// general stuff // general stuff
'version' => $version, 'version' => $version,
@ -100,7 +98,7 @@ class OtherController extends GenericApiController
'preview_generator_enabled' => Util::previewGeneratorIsEnabled(), 'preview_generator_enabled' => Util::previewGeneratorIsEnabled(),
// general settings // general settings
'timeline_path' => $getAppConfig('timelinePath', $defaultTimelinePath), 'timeline_path' => $getAppConfig('timelinePath', Util::getSystemConfig('memories.timeline.default_path')),
'enable_top_memories' => 'true' === $getAppConfig('enableTopMemories', 'true'), 'enable_top_memories' => 'true' === $getAppConfig('enableTopMemories', 'true'),
// viewer settings // viewer settings

View File

@ -21,6 +21,10 @@ return [
// Places database type identifier // Places database type identifier
'memories.gis_type' => -1, 'memories.gis_type' => -1,
// Default timeline path for all users
// If set to '_empty_', the user is prompted to select a path on first open (default)
'memories.timeline.default_path' => '_empty_',
// Default viewer high resolution image loading condition // Default viewer high resolution image loading condition
// Valid values: 'always' | 'zoom' | 'never' // Valid values: 'always' | 'zoom' | 'never'
'memories.viewer.high_res_cond_default' => 'zoom', 'memories.viewer.high_res_cond_default' => 'zoom',
@ -70,9 +74,6 @@ return [
// 1080 => 1080p (and so on) // 1080 => 1080p (and so on)
'memories.video_default_quality' => '0', '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 // Memories only provides an admin interface for these
// https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#previews // https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#previews
'enabledPreviewProviders' => [], 'enabledPreviewProviders' => [],

View File

@ -316,8 +316,8 @@ class Util
public static function getTimelinePaths(string $uid): array public static function getTimelinePaths(string $uid): array
{ {
$config = \OC::$server->get(IConfig::class); $config = \OC::$server->get(IConfig::class);
$defaultTimelinePath = self::getSystemConfig('memories.default_timeline_path'); $paths = $config->getUserValue($uid, Application::APPNAME, 'timelinePath', null)
$paths = $config->getUserValue($uid, Application::APPNAME, 'timelinePath', null) ?? $defaultTimelinePath; ?? self::getSystemConfig('memories.timeline.default_path');
return array_map(static fn ($p) => self::sanitizePath(trim($p)), explode(';', $paths)); return array_map(static fn ($p) => self::sanitizePath(trim($p)), explode(';', $paths));
} }

View File

@ -3,7 +3,7 @@
<NcContent <NcContent
app-name="memories" app-name="memories"
v-else v-else-if="!isConfigUnknown"
:class="{ :class="{
'remove-gap': removeOuterGap, 'remove-gap': removeOuterGap,
'has-nav': showNavigation, 'has-nav': showNavigation,
@ -187,7 +187,11 @@ export default defineComponent({
}, },
isFirstStart(): boolean { isFirstStart(): boolean {
return this.config.timeline_path === 'EMPTY' && !this.routeIsPublic && !this.$route.query.noinit; return this.config.timeline_path === '_empty_' && !this.routeIsPublic && !this.$route.query.noinit;
},
isConfigUnknown(): boolean {
return this.config.timeline_path === '_unknown_';
}, },
showAlbums(): boolean { showAlbums(): boolean {

View File

@ -118,7 +118,7 @@ class StaticConfig {
preview_generator_enabled: false, preview_generator_enabled: false,
// general settings // general settings
timeline_path: '', timeline_path: '_unknown_',
enable_top_memories: true, enable_top_memories: true,
// viewer settings // viewer settings