From 6a827149d5749af0679321f66af2b4ee976159d6 Mon Sep 17 00:00:00 2001 From: Art051 <91856576+Art051@users.noreply.github.com> Date: Sun, 12 May 2024 16:07:13 +0100 Subject: [PATCH] removed multiple invocations of notification. Added count to final notification which appears at the end of upload process. --- .../shared-components/upload-panel.svelte | 2 +- web/src/lib/utils/asset-utils.ts | 17 +---------------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/web/src/lib/components/shared-components/upload-panel.svelte b/web/src/lib/components/shared-components/upload-panel.svelte index bbcba662b..0889fc29d 100644 --- a/web/src/lib/components/shared-components/upload-panel.svelte +++ b/web/src/lib/components/shared-components/upload-panel.svelte @@ -41,7 +41,7 @@ }); } else if ($successCounter > 0) { notificationController.show({ - message: 'Upload success, refresh the page to see new upload assets.', + message: `Uploaded ${$successCounter} assets successfully, refresh the page to see new upload assets.`, type: NotificationType.Info, }); } diff --git a/web/src/lib/utils/asset-utils.ts b/web/src/lib/utils/asset-utils.ts index 5a69e6eea..8a6d5df88 100644 --- a/web/src/lib/utils/asset-utils.ts +++ b/web/src/lib/utils/asset-utils.ts @@ -25,28 +25,13 @@ import { get } from 'svelte/store'; import { handleError } from './handle-error'; export const addAssetsToAlbum = async (albumId: string, assetIds: string[]) => { - const result = await addAssets({ + await addAssets({ id: albumId, bulkIdsDto: { ids: assetIds, }, key: getKey(), }); - const count = result.filter(({ success }) => success).length; - notificationController.show({ - type: NotificationType.Info, - timeout: 5000, - message: - count > 0 - ? `Added ${count} asset${count === 1 ? '' : 's'} to the album` - : `Asset${assetIds.length === 1 ? ' was' : 's were'} already part of the album`, - button: { - text: 'View Album', - onClick() { - return goto(`${AppRoute.ALBUMS}/${albumId}`); - }, - }, - }); }; export const addAssetsToNewAlbum = async (albumName: string, assetIds: string[]) => {