mirror of
https://github.com/immich-app/immich.git
synced 2024-12-29 07:01: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,
|
notificationController,
|
||||||
} from '$lib/components/shared-components/notification/notification';
|
} from '$lib/components/shared-components/notification/notification';
|
||||||
import { s } from '$lib/utils';
|
import { s } from '$lib/utils';
|
||||||
import { deleteAssets, getConfig, updateAssets } from '@immich/sdk';
|
import { deleteAssets, updateAssets } from '@immich/sdk';
|
||||||
import { t } from 'svelte-i18n';
|
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;
|
export let data: PageData;
|
||||||
|
|
||||||
const handleResolve = async (duplicateId: string, duplicateAssetIds: string[], trashIds: string[]) => {
|
const handleResolve = async (duplicateId: string, duplicateAssetIds: string[], trashIds: string[]) => {
|
||||||
try {
|
try {
|
||||||
const { trash } = await getConfig();
|
if (!$featureFlags.trash && trashIds.length > 0) {
|
||||||
// TODO - Create showConfirmDialog controller to show native confirm.
|
const isConfirmed = await dialogController.show({
|
||||||
if (
|
title: 'Confirm',
|
||||||
!trash.enabled &&
|
prompt: 'Are you sure you want to permanently delete these duplicates?',
|
||||||
trashIds.length > 0 &&
|
confirmText: 'Yes',
|
||||||
!confirm('Are you sure you want to permanently delete these duplicates?')
|
cancelText: 'No',
|
||||||
) {
|
});
|
||||||
return;
|
|
||||||
|
if (!isConfirmed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await updateAssets({ assetBulkUpdateDto: { ids: duplicateAssetIds, duplicateId: null } });
|
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);
|
data.duplicates = data.duplicates.filter((duplicate) => duplicate.duplicateId !== duplicateId);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue