mirror of
https://github.com/immich-app/immich.git
synced 2024-12-28 22:51:59 +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:
parent
60701d131e
commit
d558ea819a
1 changed files with 15 additions and 10 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue