From 4369b73efaa08835d4655cf5cb510ccea8321651 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 27 Jul 2021 13:02:57 -0300 Subject: [PATCH] Regression: fix non ee tag field on canned responses --- client/components/Omnichannel/Tags.js | 4 ++-- ee/client/omnichannel/cannedResponses/CannedResponseEdit.tsx | 5 ++++- .../CannedResponse/modals/CreateCannedResponse/index.tsx | 5 ++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/client/components/Omnichannel/Tags.js b/client/components/Omnichannel/Tags.js index 86faf461c0d39..736827496f422 100644 --- a/client/components/Omnichannel/Tags.js +++ b/client/components/Omnichannel/Tags.js @@ -68,7 +68,7 @@ const Tags = ({ tags = [], handler = () => {}, error = '', tagRequired = false } handleTagValue(event.target.value)} flexGrow={1} placeholder={t('Enter_a_tag')} @@ -80,7 +80,7 @@ const Tags = ({ tags = [], handler = () => {}, error = '', tagRequired = false } {tags.map((tag, i) => ( removeTag(tag)} mie='x8'> - {tag} + {tag?.value ? tag.value : tag} ))} diff --git a/ee/client/omnichannel/cannedResponses/CannedResponseEdit.tsx b/ee/client/omnichannel/cannedResponses/CannedResponseEdit.tsx index ec807b4753ef5..991e25ebbc70e 100644 --- a/ee/client/omnichannel/cannedResponses/CannedResponseEdit.tsx +++ b/ee/client/omnichannel/cannedResponses/CannedResponseEdit.tsx @@ -104,12 +104,15 @@ const CannedResponseEdit: FC<{ tags: any; departmentId: { value: string; label: string }; }; + const mappedTags = tags.map((tag: string | { value: string; label: string }) => + typeof tag === 'object' ? tag?.value : tag, + ); await saveCannedResponse({ ...(_id && { _id }), shortcut, text, scope, - ...(tags.length > 0 && { tags }), + ...(mappedTags.length > 0 && { tags: mappedTags }), ...(departmentId && { departmentId: departmentId.value }), }); dispatchToastMessage({ diff --git a/ee/client/omnichannel/components/CannedResponse/modals/CreateCannedResponse/index.tsx b/ee/client/omnichannel/components/CannedResponse/modals/CreateCannedResponse/index.tsx index 4d941f99cfe0a..6a6fadb083bd1 100644 --- a/ee/client/omnichannel/components/CannedResponse/modals/CreateCannedResponse/index.tsx +++ b/ee/client/omnichannel/components/CannedResponse/modals/CreateCannedResponse/index.tsx @@ -87,12 +87,15 @@ const WrapCreateCannedResponseModal: FC<{ data?: any; reloadCannedList?: any }> tags: any; departmentId: { value: string; label: string }; }; + const mappedTags = tags.map((tag: string | { value: string; label: string }) => + typeof tag === 'object' ? tag?.value : tag, + ); await saveCannedResponse({ ...(_id && { _id }), shortcut, text, scope, - ...(tags.length > 0 && { tags }), + ...(tags.length > 0 && { tags: mappedTags }), ...(departmentId && { departmentId: departmentId.value }), }); dispatchToastMessage({