1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2024-12-29 15:11:58 +00:00

fix(web): cannot perform duplication actions as normal user (#10115)

* fix(web): cannot perform duplication actions as normal user

* use immich dialog
This commit is contained in:
Alex 2024-06-11 06:30:42 -05:00 committed by GitHub
parent 60701d131e
commit d558ea819a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,25 +9,30 @@
notificationController,
} from '$lib/components/shared-components/notification/notification';
import { s } from '$lib/utils';
import { deleteAssets, getConfig, updateAssets } from '@immich/sdk';
import { deleteAssets, updateAssets } from '@immich/sdk';
import { t } from 'svelte-i18n';
import { featureFlags } from '$lib/stores/server-config.store';
import { dialogController } from '$lib/components/shared-components/dialog/dialog';
export let data: PageData;
const handleResolve = async (duplicateId: string, duplicateAssetIds: string[], trashIds: string[]) => {
try {
const { trash } = await getConfig();
// TODO - Create showConfirmDialog controller to show native confirm.
if (
!trash.enabled &&
trashIds.length > 0 &&
!confirm('Are you sure you want to permanently delete these duplicates?')
) {
return;
if (!$featureFlags.trash && trashIds.length > 0) {
const isConfirmed = await dialogController.show({
title: 'Confirm',
prompt: 'Are you sure you want to permanently delete these duplicates?',
confirmText: 'Yes',
cancelText: 'No',
});
if (!isConfirmed) {
return;
}
}
await updateAssets({ assetBulkUpdateDto: { ids: duplicateAssetIds, duplicateId: null } });
await deleteAssets({ assetBulkDeleteDto: { ids: trashIds, force: !trash.enabled } });
await deleteAssets({ assetBulkDeleteDto: { ids: trashIds, force: !$featureFlags.trash } });
data.duplicates = data.duplicates.filter((duplicate) => duplicate.duplicateId !== duplicateId);