Skip to content
5 changes: 5 additions & 0 deletions .changeset/real-grapes-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes an issue where it‘s not being possible to configure department's `chatClosingTags` without enabling `requestTagBeforeClosingTag`
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const DepartmentTags = ({ error, value: tags, onChange, ...props }: DepartmentTa
</Button>
</FieldRow>
{tags?.length > 0 && (
<FieldRow>
<FieldRow justifyContent='flex-start'>
{tags.map((tag, i) => (
<Chip key={i} onClick={handleTagChipClick(tag)} mie={8}>
{tag}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,9 @@ function EditDepartment({ data, id, title, allowedToForwardData }: EditDepartmen
register,
control,
handleSubmit,
watch,
formState: { errors, isValid, isDirty, isSubmitting },
} = useForm<EditDepartmentFormData>({ mode: 'onChange', defaultValues: initialValues });

const requestTagBeforeClosingChat = watch('requestTagBeforeClosingChat');

const [fallbackFilter, setFallbackFilter] = useState<string>('');
const [isUnitRequired, setUnitRequired] = useState(false);

Expand Down Expand Up @@ -414,33 +411,28 @@ function EditDepartment({ data, id, title, allowedToForwardData }: EditDepartmen
</FieldRow>
</Field>

{requestTagBeforeClosingChat && (
<Field>
<FieldLabel htmlFor={chatClosingTagsField} required>
{t('Conversation_closing_tags')}
</FieldLabel>
<Controller
control={control}
name='chatClosingTags'
rules={{ required: t('Required_field', 'tags') }}
render={({ field: { value, onChange } }) => (
<DepartmentTags
id={chatClosingTagsField}
value={value}
onChange={onChange}
error={errors.chatClosingTags?.message as string}
aria-describedby={`${chatClosingTagsField}-hint ${chatClosingTagsField}-error`}
/>
)}
/>
<FieldHint id={`${chatClosingTagsField}-hint`}>{t('Conversation_closing_tags_description')}</FieldHint>
{errors.chatClosingTags && (
<FieldError aria-live='assertive' id={`${chatClosingTagsField}-error`}>
{errors.chatClosingTags?.message}
</FieldError>
<Field>
<FieldLabel htmlFor={chatClosingTagsField}>{t('Conversation_closing_tags')}</FieldLabel>
<Controller
control={control}
name='chatClosingTags'
render={({ field: { value, onChange } }) => (
<DepartmentTags
id={chatClosingTagsField}
value={value}
onChange={onChange}
error={errors.chatClosingTags?.message as string}
aria-describedby={`${chatClosingTagsField}-hint ${chatClosingTagsField}-error`}
/>
)}
</Field>
)}
/>
<FieldHint id={`${chatClosingTagsField}-hint`}>{t('Conversation_closing_tags_description')}</FieldHint>
{errors.chatClosingTags && (
<FieldError aria-live='assertive' id={`${chatClosingTagsField}-error`}>
{errors.chatClosingTags?.message}
</FieldError>
)}
</Field>

<Field>
<FieldRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,13 @@ test.describe('OC - Manage Departments', () => {
await expect(poOmnichannelDepartments.toggleRequestTags).toBeVisible();
});

await test.step('expect have no add tag to department', async () => {
await expect(poOmnichannelDepartments.inputTags).not.toBeVisible();
await expect(poOmnichannelDepartments.btnTagsAdd).not.toBeVisible();
await test.step('expect tag input to be visible but disabled', async () => {
await expect(poOmnichannelDepartments.inputTags).toBeVisible();
await expect(poOmnichannelDepartments.btnTagsAdd).toBeVisible();

await expect(poOmnichannelDepartments.inputTags).toBeDisabled();
await expect(poOmnichannelDepartments.btnTagsAdd).toBeDisabled();

await poOmnichannelDepartments.btnBack.click();
});
});
Expand All @@ -244,8 +248,8 @@ test.describe('OC - Manage Departments', () => {

await test.step('expect clicking on toggle button to enable tags', async () => {
await poOmnichannelDepartments.toggleRequestTags.click();
await expect(poOmnichannelDepartments.inputTags).toBeVisible();
await expect(poOmnichannelDepartments.btnTagsAdd).toBeVisible();

await expect(poOmnichannelDepartments.inputTags).toBeEnabled();
});

await test.step('expect to have add and remove one tag properly tags', async () => {
Expand Down
Loading