Hide selection menus on public link

old-stable24
Varun Patil 2022-10-28 19:08:00 -07:00
parent 64ab75a1e9
commit 4d1a4a34d9
2 changed files with 9 additions and 1 deletions

View File

@ -124,6 +124,7 @@ export default class SelectionHandler extends Mixins(GlobalMixin, UserConfig) {
name: t("memories", "Download"), name: t("memories", "Download"),
icon: DownloadIcon, icon: DownloadIcon,
callback: this.downloadSelection.bind(this), callback: this.downloadSelection.bind(this),
allowPublic: true,
}, },
{ {
name: t("memories", "Favorite"), name: t("memories", "Favorite"),
@ -190,7 +191,7 @@ export default class SelectionHandler extends Mixins(GlobalMixin, UserConfig) {
/** Get the actions list */ /** Get the actions list */
private getActions(): ISelectionAction[] { 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 */ /** Clear all selected photos */
@ -411,6 +412,11 @@ export default class SelectionHandler extends Mixins(GlobalMixin, UserConfig) {
return this.config_albumsEnabled && this.$route.name === "albums"; 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 * Move selected photos to album
*/ */

View File

@ -206,4 +206,6 @@ export type ISelectionAction = {
callback: (selection: Map<number, IPhoto>) => Promise<void>; callback: (selection: Map<number, IPhoto>) => Promise<void>;
/** Condition to check for including */ /** Condition to check for including */
if?: (self?: any) => boolean; if?: (self?: any) => boolean;
/** Allow for public routes (default false) */
allowPublic?: boolean;
}; };