onthisday: allow disabling at top (fix #368)

pull/400/head
Varun Patil 2023-02-09 13:13:44 -08:00
parent 3fde5c1caf
commit b584add525
5 changed files with 33 additions and 18 deletions

View File

@ -63,24 +63,20 @@ class PageController extends Controller
// Configuration
$uid = $user->getUID();
$this->initialState->provideInitialState('timelinePath', $this->config->getUserValue(
$pi = function ($key, $default) use ($uid) {
$this->initialState->provideInitialState($key, $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
$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'));

View File

@ -47,6 +47,14 @@
>
{{ t("memories", "Square grid mode") }}
</NcCheckboxRadioSwitch>
<NcCheckboxRadioSwitch
:checked.sync="config_enableTopMemories"
@update:checked="updateEnableTopMemories"
type="switch"
>
{{ t("memories", "Show past photos on top of timeline") }}
</NcCheckboxRadioSwitch>
</NcAppSettingsSection>
<NcAppSettingsSection
@ -171,6 +179,10 @@ export default defineComponent({
await this.updateSetting("squareThumbs");
},
async updateEnableTopMemories() {
await this.updateSetting("enableTopMemories");
},
async updateShowHidden() {
await this.updateSetting("showHidden");
},

View File

@ -101,6 +101,9 @@ export default defineComponent({
},
async refresh() {
// Skip if disabled
if (!this.config_enableTopMemories) return;
// Look for cache
const dayIdToday = utils.dateToDayId(new Date());
const cacheUrl = `/onthisday/${dayIdToday}`;

View File

@ -21,8 +21,11 @@ export default defineComponent({
"foldersPath",
<string>"/"
) as string,
config_showHidden:
loadState("memories", "showHidden", <string>"false") === "true",
config_enableTopMemories:
loadState("memories", "enableTopMemories", <string>"false") === "true",
config_tagsEnabled: Boolean(
loadState("memories", "systemtags", <string>"")

View File

@ -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;