From 63dbf56a70dc52c94bf69eeceb085a4771c930be Mon Sep 17 00:00:00 2001 From: Yousefa7medmaher Date: Mon, 22 Sep 2025 12:57:39 +0300 Subject: [PATCH] fix(shared-links): handle Delete key to remove assets from shared link Previously, pressing the Delete key on selected assets in the Shared Link view sent them to trash instead of removing them from the shared link. This commit updates the `onDelete` handler in the shared link view to call the `removeFromSharedLink` function, ensuring that both the Delete key and the UI delete button correctly remove assets from the shared link. --- .../gallery-viewer/gallery-viewer.svelte | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/web/src/lib/components/shared-components/gallery-viewer/gallery-viewer.svelte b/web/src/lib/components/shared-components/gallery-viewer/gallery-viewer.svelte index e8c1a35dd7..da39300dc9 100644 --- a/web/src/lib/components/shared-components/gallery-viewer/gallery-viewer.svelte +++ b/web/src/lib/components/shared-components/gallery-viewer/gallery-viewer.svelte @@ -242,15 +242,22 @@ } }; - const onDelete = () => { - const hasTrashedAsset = assetInteraction.selectedAssets.some((asset) => asset.isTrashed); +const onDelete = () => { + const hasTrashedAsset = assetInteraction.selectedAssets.some((asset) => asset.isTrashed); + + if (isSharedLinkView) { + removeFromSharedLink(link.id, assetInteraction.selectedAssets.map(a => a.id)); + return; + } + + if ($showDeleteModal && (!isTrashEnabled || hasTrashedAsset)) { + isShowDeleteConfirmation = true; + return; + } + + handlePromiseError(trashOrDelete(hasTrashedAsset)); +}; - if ($showDeleteModal && (!isTrashEnabled || hasTrashedAsset)) { - isShowDeleteConfirmation = true; - return; - } - handlePromiseError(trashOrDelete(hasTrashedAsset)); - }; const onForceDelete = () => { if ($showDeleteModal) {