From b584add5254167b7975ac1d3e23eb7a430a74266 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Thu, 9 Feb 2023 13:13:44 -0800 Subject: [PATCH] onthisday: allow disabling at top (fix #368) --- lib/Controller/PageController.php | 32 +++++++++++-------------- src/components/Settings.vue | 12 ++++++++++ src/components/top-matter/OnThisDay.vue | 3 +++ src/mixins/UserConfig.ts | 3 +++ src/vue-globals.d.ts | 1 + 5 files changed, 33 insertions(+), 18 deletions(-) diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 547ba61c..7da3b4ce 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -63,24 +63,20 @@ class PageController extends Controller // Configuration $uid = $user->getUID(); - $this->initialState->provideInitialState('timelinePath', $this->config->getUserValue( - $uid, - Application::APPNAME, - 'timelinePath', - 'EMPTY' - )); - $this->initialState->provideInitialState('foldersPath', $this->config->getUserValue( - $uid, - Application::APPNAME, - 'foldersPath', - '/' - )); - $this->initialState->provideInitialState('showHidden', $this->config->getUserValue( - $uid, - Application::APPNAME, - 'showHidden', - false - )); + $pi = function ($key, $default) use ($uid) { + $this->initialState->provideInitialState($key, $this->config->getUserValue( + $uid, + Application::APPNAME, + $key, + $default + )); + }; + + // User configuration + $pi('timelinePath', 'EMPTY'); + $pi('foldersPath', '/'); + $pi('showHidden', false); + $pi('enableTopMemories', "true"); // Apps enabled $this->initialState->provideInitialState('systemtags', true === $this->appManager->isEnabledForUser('systemtags')); diff --git a/src/components/Settings.vue b/src/components/Settings.vue index 517d962a..38586653 100644 --- a/src/components/Settings.vue +++ b/src/components/Settings.vue @@ -47,6 +47,14 @@ > {{ t("memories", "Square grid mode") }} + + + {{ t("memories", "Show past photos on top of timeline") }} + "/" ) as string, + config_showHidden: loadState("memories", "showHidden", "false") === "true", + config_enableTopMemories: + loadState("memories", "enableTopMemories", "false") === "true", config_tagsEnabled: Boolean( loadState("memories", "systemtags", "") diff --git a/src/vue-globals.d.ts b/src/vue-globals.d.ts index 34f991dc..a693573c 100644 --- a/src/vue-globals.d.ts +++ b/src/vue-globals.d.ts @@ -24,6 +24,7 @@ declare module "vue" { config_albumsEnabled: boolean; config_placesGis: number; config_squareThumbs: boolean; + config_enableTopMemories: boolean; config_showFaceRect: boolean; config_eventName: string;