mirror of
https://github.com/immich-app/immich
synced 2026-08-29 13:15:45 +00:00
fix(web): misleading toast notification (#30976)
* Added the proper toast for each scenario in the if/else statement instead of only having toastManager.primary() for all scenarios. * Created a test file for album.service.ts. * chore: cleanup --------- Co-authored-by: Daniel Dietzler <mail@ddietzler.dev>
This commit is contained in:
parent
dc3d6eeec4
commit
84adce7d43
1 changed files with 9 additions and 3 deletions
|
|
@ -133,7 +133,7 @@ export const addAssetsToAlbums = async (albumIds: string[], assetIds: string[],
|
|||
const notifyAddToAlbum = ($t: MessageFormatter, albumId: string, assetIds: string[], results: BulkIdResponseDto[]) => {
|
||||
const successCount = results.filter(({ success }) => success).length;
|
||||
const duplicateCount = results.filter(({ error }) => error === 'duplicate').length;
|
||||
let description = $t('assets_cannot_be_added_to_album_count', { values: { count: assetIds.length } });
|
||||
let description: string | undefined;
|
||||
|
||||
if (duplicateCount === assetIds.length) {
|
||||
description = $t('assets_were_part_of_album_count', { values: { count: duplicateCount } });
|
||||
|
|
@ -143,8 +143,14 @@ const notifyAddToAlbum = ($t: MessageFormatter, albumId: string, assetIds: strin
|
|||
description = $t('assets_added_to_album_partial_count', { values: { successCount, totalCount: assetIds.length } });
|
||||
}
|
||||
|
||||
toastManager.primary(
|
||||
{ description, button: { label: $t('view_album'), onclick: () => goto(Route.viewAlbum({ id: albumId })) } },
|
||||
const button = { label: $t('view_album'), onclick: () => goto(Route.viewAlbum({ id: albumId })) };
|
||||
if (description) {
|
||||
toastManager.primary({ description, button }, { timeout: 5000 });
|
||||
return;
|
||||
}
|
||||
|
||||
toastManager.danger(
|
||||
{ description: $t('assets_cannot_be_added_to_album_count', { values: { count: assetIds.length } }), button },
|
||||
{ timeout: 5000 },
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue