viewer: fix delete on albums
parent
50b2756bbd
commit
be36c6860c
|
@ -153,7 +153,7 @@ export default class SelectionManager extends Mixins(GlobalMixin, UserConfig) {
|
|||
{
|
||||
name: t("memories", "Remove from album"),
|
||||
icon: AlbumRemoveIcon,
|
||||
callback: this.removeFromAlbum.bind(this),
|
||||
callback: this.deleteSelection.bind(this),
|
||||
if: () => this.routeIsAlbum(),
|
||||
},
|
||||
{
|
||||
|
@ -795,35 +795,6 @@ export default class SelectionManager extends Mixins(GlobalMixin, UserConfig) {
|
|||
(<any>this.$refs.addToAlbumModal).open(Array.from(selection.values()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove selected photos from album
|
||||
*/
|
||||
private async removeFromAlbum(selection: Selection) {
|
||||
try {
|
||||
this.updateLoading(1);
|
||||
const user = this.$route.params.user;
|
||||
const name = this.$route.params.name;
|
||||
const gen = dav.removeFromAlbum(
|
||||
user,
|
||||
name,
|
||||
Array.from(selection.values())
|
||||
);
|
||||
for await (const delIds of gen) {
|
||||
const delPhotos = delIds
|
||||
.filter((p) => p)
|
||||
.map((id) => selection.get(id));
|
||||
this.deletePhotos(delPhotos);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
showError(
|
||||
e?.message || this.t("memories", "Could not remove photos from album")
|
||||
);
|
||||
} finally {
|
||||
this.updateLoading(-1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move selected photos to another person
|
||||
*/
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<template #icon> <ShareIcon :size="24" /> </template>
|
||||
</NcActionButton>
|
||||
<NcActionButton
|
||||
v-if="!routeIsPublic"
|
||||
v-if="!routeIsPublic && !routeIsAlbum"
|
||||
:aria-label="t('memories', 'Delete')"
|
||||
@click="deleteCurrent"
|
||||
:close-after-click="true"
|
||||
|
@ -44,6 +44,15 @@
|
|||
{{ t("memories", "Delete") }}
|
||||
<template #icon> <DeleteIcon :size="24" /> </template>
|
||||
</NcActionButton>
|
||||
<NcActionButton
|
||||
v-if="!routeIsPublic && routeIsAlbum"
|
||||
:aria-label="t('memories', 'Remove from album')"
|
||||
@click="deleteCurrent"
|
||||
:close-after-click="true"
|
||||
>
|
||||
{{ t("memories", "Remove from album") }}
|
||||
<template #icon> <AlbumRemoveIcon :size="24" /> </template>
|
||||
</NcActionButton>
|
||||
<NcActionButton
|
||||
v-if="!routeIsPublic"
|
||||
:aria-label="t('memories', 'Favorite')"
|
||||
|
@ -101,7 +110,7 @@
|
|||
</template>
|
||||
</NcActionButton>
|
||||
<NcActionButton
|
||||
v-if="!routeIsPublic"
|
||||
v-if="!routeIsPublic && !routeIsAlbum"
|
||||
:aria-label="t('memories', 'View in folder')"
|
||||
@click="viewInFolder"
|
||||
:close-after-click="true"
|
||||
|
@ -190,6 +199,7 @@ import OpenInNewIcon from "vue-material-design-icons/OpenInNew.vue";
|
|||
import TuneIcon from "vue-material-design-icons/Tune.vue";
|
||||
import SlideshowIcon from "vue-material-design-icons/PlayBox.vue";
|
||||
import EditFileIcon from "vue-material-design-icons/FileEdit.vue";
|
||||
import AlbumRemoveIcon from "vue-material-design-icons/BookRemove.vue";
|
||||
|
||||
const SLIDESHOW_MS = 5000;
|
||||
|
||||
|
@ -208,6 +218,7 @@ const SLIDESHOW_MS = 5000;
|
|||
TuneIcon,
|
||||
SlideshowIcon,
|
||||
EditFileIcon,
|
||||
AlbumRemoveIcon,
|
||||
},
|
||||
})
|
||||
export default class Viewer extends Mixins(GlobalMixin) {
|
||||
|
@ -275,6 +286,11 @@ export default class Viewer extends Mixins(GlobalMixin) {
|
|||
return this.$route.name === "folder-share";
|
||||
}
|
||||
|
||||
/** Route is album */
|
||||
get routeIsAlbum() {
|
||||
return this.$route.name === "albums";
|
||||
}
|
||||
|
||||
/** Update the document title */
|
||||
private updateTitle(photo: IPhoto | undefined) {
|
||||
if (!this.originalTitle) {
|
||||
|
|
Loading…
Reference in New Issue