diff --git a/src/admin/select/AdminBatchEditPanelClient.tsx b/src/admin/select/AdminBatchEditPanelClient.tsx index eafcd9eb..6e4fc4ae 100644 --- a/src/admin/select/AdminBatchEditPanelClient.tsx +++ b/src/admin/select/AdminBatchEditPanelClient.tsx @@ -122,22 +122,32 @@ export default function AdminBatchEditPanelClient({ onClick={() => { setIsPerformingSelectEdit?.(true); if (isInTagMode) { + const tagsArray = convertStringToArray(tags, false); + const tagsFormatted = tagsArray + .map(tag => `"${tag}"`) + .join(', '); batchPhotoAction({ ...batchPhotoActionArguments, - tags: convertStringToArray(tags, false), + tags: tagsArray, }) .then(() => { - toastSuccess(`${photosText} tagged`); + toastSuccess(`${photosText} tagged ${tagsFormatted}`); stopSelectingPhotos?.(); }) .finally(() => setIsPerformingSelectEdit?.(false)); } else if (isInAlbumMode) { + const albumTitlesArray = convertStringToArray(albumTitles, false); + const albumTitlesFormatted = albumTitlesArray + .map(title => `"${title}"`) + .join(', '); batchPhotoAction({ ...batchPhotoActionArguments, - albumTitles: albumTitles.split(','), + albumTitles: albumTitlesArray, }) .then(() => { - toastSuccess(`${photosText} added`); + toastSuccess( + `${photosText} added to ${albumTitlesFormatted}`, + ); stopSelectingPhotos?.(); }) .finally(() => setIsPerformingSelectEdit?.(false)); diff --git a/src/components/TagInput.tsx b/src/components/TagInput.tsx index 05a87e42..361d03b5 100644 --- a/src/components/TagInput.tsx +++ b/src/components/TagInput.tsx @@ -71,7 +71,7 @@ export default function TagInput({ , [options]); const selectedOptions = useMemo(() => - convertStringToArray(value, shouldParameterize) ?? [] + convertStringToArray(value, shouldParameterize) , [value, shouldParameterize]); const hasReachedLimit = useMemo(() => diff --git a/src/photo/form/index.ts b/src/photo/form/index.ts index 1a170cf5..be85b270 100644 --- a/src/photo/form/index.ts +++ b/src/photo/form/index.ts @@ -401,7 +401,7 @@ export const convertFormDataToPhotoDbInsert = ( : formData; // Capture tags before 'favorite' is excluded from insert - const tags = convertStringToArray(photoForm.tags) ?? []; + const tags = convertStringToArray(photoForm.tags); if (photoForm.favorite === 'true') { tags.push(TAG_FAVS); } diff --git a/src/tag/index.ts b/src/tag/index.ts index 37ed1465..2d07bb14 100644 --- a/src/tag/index.ts +++ b/src/tag/index.ts @@ -30,7 +30,7 @@ export const formatTag = (tag?: string) => capitalizeWords(tag?.replaceAll('-', ' ')); export const getValidationMessageForTags = (tags?: string) => { - const reservedTags = (convertStringToArray(tags) ?? []) + const reservedTags = convertStringToArray(tags) .filter(tag => isTagFavs(tag) || isTagPrivate(tag)) .map(tag => tag.toLocaleUpperCase()); return reservedTags.length diff --git a/src/utility/string.ts b/src/utility/string.ts index f5c1e220..b78ad04d 100644 --- a/src/utility/string.ts +++ b/src/utility/string.ts @@ -10,7 +10,7 @@ export const convertStringToArray = ( ? string.split(',').map(item => shouldParameterize ? parameterize(item) : item.trim()) - : undefined; + : []; export const capitalize = (string: string) => string.charAt(0).toLocaleUpperCase() + string.slice(1);