Skip to content

Commit

Permalink
[FIX] Show only enabled departments on forward (#24829)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevLehman authored Mar 16, 2022
1 parent a0122ac commit da7653e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/livechat/client/views/app/tabbar/visitorForward.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Template.visitorForward.onCreated(async function () {
}
});

const { departments } = await APIClient.v1.get('livechat/department');
const { departments } = await APIClient.v1.get('livechat/department?enabled=true');
this.departments.set(departments);
});

Expand Down
3 changes: 3 additions & 0 deletions client/components/Omnichannel/hooks/useDepartmentsList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type DepartmentsListOptions = {
haveAll?: boolean;
haveNone?: boolean;
excludeDepartmentId?: string;
enabled?: boolean;
};

export const useDepartmentsList = (
Expand Down Expand Up @@ -44,6 +45,7 @@ export const useDepartmentsList = (
count: end + start,
sort: `{ "name": 1 }`,
excludeDepartmentId: options.excludeDepartmentId,
enabled: options.enabled,
});

const items = departments
Expand Down Expand Up @@ -87,6 +89,7 @@ export const useDepartmentsList = (
options.onlyMyDepartments,
options.haveNone,
options.excludeDepartmentId,
options.enabled,
t,
],
);
Expand Down
2 changes: 1 addition & 1 deletion client/components/Omnichannel/modals/ForwardChatModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const ForwardChatModal = ({ onForward, onCancel, room, ...props }) => {
const debouncedDepartmentsFilter = useDebouncedValue(departmentsFilter, 500);

const { itemsList: departmentsList, loadMoreItems: loadMoreDepartments } = useDepartmentsList(
useMemo(() => ({ filter: debouncedDepartmentsFilter }), [debouncedDepartmentsFilter]),
useMemo(() => ({ filter: debouncedDepartmentsFilter, enabled: true }), [debouncedDepartmentsFilter]),
);

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

0 comments on commit da7653e

Please sign in to comment.