diff --git a/i18n/en.json b/i18n/en.json
index 849f96e4a5..2fbce6fbb7 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -463,6 +463,7 @@
"assets_added_count": "Added {count, plural, one {# asset} other {# assets}}",
"assets_added_to_album_count": "Added {count, plural, one {# asset} other {# assets}} to the album",
"assets_added_to_name_count": "Added {count, plural, one {# asset} other {# assets}} to {hasName, select, true {{name}} other {new album}}",
+ "assets_cannot_be_added_to_album_count": "{count, plural, one {Asset} other {Assets}} cannot be added to the album",
"assets_count": "{count, plural, one {# asset} other {# assets}}",
"assets_deleted_permanently": "{count} asset(s) deleted permanently",
"assets_deleted_permanently_from_server": "{count} asset(s) deleted permanently from the Immich server",
diff --git a/web/src/lib/utils/asset-utils.ts b/web/src/lib/utils/asset-utils.ts
index cb4c9eeff0..b64ab51124 100644
--- a/web/src/lib/utils/asset-utils.ts
+++ b/web/src/lib/utils/asset-utils.ts
@@ -52,16 +52,20 @@ export const addAssetsToAlbum = async (albumId: string, assetIds: string[], show
key: authManager.key,
});
const count = result.filter(({ success }) => success).length;
+ const duplicateErrorCount = result.filter(({ error }) => error === 'duplicate').length;
const $t = get(t);
if (showNotification) {
+ let message = $t('assets_cannot_be_added_to_album_count', { values: { count: assetIds.length } });
+ if (count > 0) {
+ message = $t('assets_added_to_album_count', { values: { count } });
+ } else if (duplicateErrorCount > 0) {
+ message = $t('assets_were_part_of_album_count', { values: { count: duplicateErrorCount } });
+ }
notificationController.show({
type: NotificationType.Info,
timeout: 5000,
- message:
- count > 0
- ? $t('assets_added_to_album_count', { values: { count } })
- : $t('assets_were_part_of_album_count', { values: { count: assetIds.length } }),
+ message,
button: {
text: $t('view_album'),
onClick() {
@@ -125,23 +129,37 @@ export const addAssetsToNewAlbum = async (albumName: string, assetIds: string[])
}
const $t = get(t);
// for reasons beyond me > doesn't work, even though it's (afaik) exactly this object
- notificationController.show<{ key: Translations; values: InterpolationValues }>({
- type: NotificationType.Info,
- timeout: 5000,
- component: {
- type: FormatBoldMessage,
- props: {
- key: 'assets_added_to_name_count',
- values: { count: assetIds.length, name: albumName, hasName: !!albumName },
+ if (album.assets.length === 0) {
+ notificationController.show({
+ type: NotificationType.Info,
+ timeout: 5000,
+ message: $t('assets_cannot_be_added_to_album_count', { values: { count: assetIds.length } }),
+ button: {
+ text: $t('view_album'),
+ onClick() {
+ return goto(`${AppRoute.ALBUMS}/${album.id}`);
+ },
},
- },
- button: {
- text: $t('view_album'),
- onClick() {
- return goto(`${AppRoute.ALBUMS}/${album.id}`);
+ });
+ } else {
+ notificationController.show<{ key: Translations; values: InterpolationValues }>({
+ type: NotificationType.Info,
+ timeout: 5000,
+ component: {
+ type: FormatBoldMessage,
+ props: {
+ key: 'assets_added_to_name_count',
+ values: { count: album.assets.length, name: albumName, hasName: !!albumName },
+ },
},
- },
- });
+ button: {
+ text: $t('view_album'),
+ onClick() {
+ return goto(`${AppRoute.ALBUMS}/${album.id}`);
+ },
+ },
+ });
+ }
return album;
};