From ed8ae2cce12e7dcbd6efac46d6e0b786e829965c Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Fri, 28 Oct 2022 19:08:00 -0700 Subject: [PATCH] Hide selection menus on public link --- src/components/SelectionManager.vue | 8 +++++++- src/types.ts | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/SelectionManager.vue b/src/components/SelectionManager.vue index 342f8b77..288ca578 100644 --- a/src/components/SelectionManager.vue +++ b/src/components/SelectionManager.vue @@ -124,6 +124,7 @@ export default class SelectionHandler extends Mixins(GlobalMixin, UserConfig) { name: t("memories", "Download"), icon: DownloadIcon, callback: this.downloadSelection.bind(this), + allowPublic: true, }, { name: t("memories", "Favorite"), @@ -190,7 +191,7 @@ export default class SelectionHandler extends Mixins(GlobalMixin, UserConfig) { /** Get the actions list */ private getActions(): ISelectionAction[] { - return this.defaultActions.filter((a) => !a.if || a.if(this)); + return this.defaultActions.filter((a) => (!a.if || a.if(this)) && (!this.routeIsPublic() || a.allowPublic)); } /** Clear all selected photos */ @@ -411,6 +412,11 @@ export default class SelectionHandler extends Mixins(GlobalMixin, UserConfig) { return this.config_albumsEnabled && this.$route.name === "albums"; } + /** Public route that can't modify anything */ + private routeIsPublic() { + return this.$route.name === "folder-share"; + } + /** * Move selected photos to album */ diff --git a/src/types.ts b/src/types.ts index f721d5b7..d59a3a33 100644 --- a/src/types.ts +++ b/src/types.ts @@ -206,4 +206,6 @@ export type ISelectionAction = { callback: (selection: Map) => Promise; /** Condition to check for including */ if?: (self?: any) => boolean; + /** Allow for public routes (default false) */ + allowPublic?: boolean; };