Skip to content

Commit

Permalink
Merge branch 'develop' into filesDropTarget-ts
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Sep 12, 2023
2 parents 90b14dc + f0c8867 commit 4c0d1f7
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/honest-mirrors-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Disabled call to tags enterprise endpoint when on community license
5 changes: 5 additions & 0 deletions .changeset/slimy-cheetahs-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixed selected departments not being displayed due to pagination
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ type DepartmentListItem = {
_id: string;
label: string;
value: string;
_updatedAt: Date;
};

export const useDepartmentsList = (
Expand Down Expand Up @@ -66,7 +65,6 @@ export const useDepartmentsList = (
_id,
label: department.archived ? `${name} [${t('Archived')}]` : name,
value: _id,
_updatedAt: new Date(_updatedAt || ''),
};
});

Expand All @@ -75,15 +73,13 @@ export const useDepartmentsList = (
_id: '',
label: t('All'),
value: 'all',
_updatedAt: new Date(),
});

options.haveNone &&
items.unshift({
_id: '',
label: t('None'),
value: '',
_updatedAt: new Date(),
});

return {
Expand Down
20 changes: 14 additions & 6 deletions apps/meteor/client/components/Omnichannel/hooks/useLivechatTags.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { useEndpoint } from '@rocket.chat/ui-contexts';
import { useQuery } from '@tanstack/react-query';

import { useOmnichannel } from '../../../hooks/omnichannel/useOmnichannel';

type Props = {
department?: string;
text?: string;
Expand All @@ -9,13 +11,19 @@ type Props = {

export const useLivechatTags = (options: Props) => {
const getTags = useEndpoint('GET', '/v1/livechat/tags');
const { isEnterprise } = useOmnichannel();

const { department, text, viewAll } = options;
return useQuery(['/v1/livechat/tags', text, department], () =>
getTags({
text: text || '',
...(department && { department }),
viewAll: viewAll ? 'true' : 'false',
}),
return useQuery(
['/v1/livechat/tags', text, department],
() =>
getTags({
text: text || '',
...(department && { department }),
viewAll: viewAll ? 'true' : 'false',
}),
{
enabled: isEnterprise,
},
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const EditDepartmentWithData = ({ id, title }: EditDepartmentWithDataProps) => {
});

if (isInitialLoading) {
return <FormSkeleton />;
return <FormSkeleton padding='1.5rem 1rem' maxWidth='37.5rem' margin='0 auto' />;
}

if (isError || (id && !data?.department)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ export const DepartmentForwarding = ({ departmentId, value = [], handler, label

const { phase: departmentsPhase, items: departmentsItems, itemCount: departmentsTotal } = useRecordList(departmentsList);

const options = useMemo(() => {
const pending = value.filter(({ value }) => !departmentsItems.find((dep) => dep.value === value));
return [...departmentsItems, ...pending];
}, [departmentsItems, value]);

return (
<Field>
<Field.Label>{t(label)}</Field.Label>
Expand All @@ -41,7 +46,7 @@ export const DepartmentForwarding = ({ departmentId, value = [], handler, label
filter={debouncedDepartmentsFilter}
setFilter={setDepartmentsFilter}
onChange={handler}
options={departmentsItems}
options={options}
value={value}
placeholder={t('Select_an_option')}
endReached={
Expand Down

0 comments on commit 4c0d1f7

Please sign in to comment.