Hide selection menus on public link

old-stable24^2
Varun Patil 2022-10-28 19:08:00 -07:00
parent 4c66ef1949
commit ed8ae2cce1
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"),
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
*/

View File

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