Regression: fix non ee tag field on canned responses (#22775)

Co-authored-by: Kevin Aleman <kevin.aleman@rocket.chat>
pull/22772/head^2
Martin Schoeler 5 years ago committed by GitHub
parent 10be38ba94
commit 32f5b8d2fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      client/components/Omnichannel/Tags.js
  2. 5
      ee/client/omnichannel/cannedResponses/CannedResponseEdit.tsx
  3. 5
      ee/client/omnichannel/components/CannedResponse/modals/CreateCannedResponse/index.tsx

@ -68,7 +68,7 @@ const Tags = ({ tags = [], handler = () => {}, error = '', tagRequired = false }
<Field.Row>
<TextInput
error={error}
value={tagValue}
value={tagValue?.value ? tagValue.value : tagValue}
onChange={(event) => handleTagValue(event.target.value)}
flexGrow={1}
placeholder={t('Enter_a_tag')}
@ -80,7 +80,7 @@ const Tags = ({ tags = [], handler = () => {}, error = '', tagRequired = false }
<Field.Row justifyContent='flex-start'>
{tags.map((tag, i) => (
<Chip key={i} onClick={() => removeTag(tag)} mie='x8'>
{tag}
{tag?.value ? tag.value : tag}
</Chip>
))}
</Field.Row>

@ -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({

@ -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({

Loading…
Cancel
Save