albums: fix deletion message

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/807/merge
Varun Patil 2023-10-03 19:12:17 -07:00
parent 6d3fa7d27b
commit 62bbe2470a
2 changed files with 18 additions and 2 deletions

View File

@ -218,9 +218,17 @@ export async function* deletePhotos(photos: IPhoto[], confirm: boolean = true) {
}
// Show confirmation dialog if required
if (confirm && !(await utils.dialogs.moveToTrash(photos.length))) {
if (confirm) {
if (routeIsAlbums) {
if (!(await utils.dialogs.removeFromAlbum(photos.length))) {
throw new Error('User cancelled removal');
}
} else {
if (!(await utils.dialogs.moveToTrash(photos.length))) {
throw new Error('User cancelled deletion');
}
}
}
// Delete local files.
if (hasNative) {

View File

@ -92,6 +92,14 @@ export const dialogs = {
message: t('memories', 'Files in trash may be automatically deleted after a fixed period of time.'),
}),
removeFromAlbum: (count: number) =>
confirmDestructive({
title: n('memories', 'Remove {count} item from album?', 'Remove {count} items from album?', count, {
count,
}),
message: t('memories', 'This will not delete your original files.'),
}),
downloadItems: (count: number) =>
confirmDestructive({
title: t('memories', 'Download'),