Skip to content

Commit

Permalink
fix: changed UserAutoComplete to AutoCompleteAgent in ForwardChatModal
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandernsilva committed Oct 13, 2023
1 parent 8217123 commit b32b7f8
Showing 1 changed file with 5 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { useForm } from 'react-hook-form';

import { useRecordList } from '../../../hooks/lists/useRecordList';
import { AsyncStatePhase } from '../../../hooks/useAsyncState';
import UserAutoComplete from '../../UserAutoComplete';
import AutoCompleteAgent from '../../AutoCompleteAgent';
import { useDepartmentsList } from '../hooks/useDepartmentsList';

const ForwardChatModal = ({
Expand Down Expand Up @@ -53,28 +53,6 @@ const ForwardChatModal = ({
);
const { phase: departmentsPhase, items: departments, itemCount: departmentsTotal } = useRecordList(departmentsList);

const _id = { $ne: room.servedBy?._id };
const conditions = {
_id,
...(!idleAgentsAllowedForForwarding && {
$or: [
{
status: {
$exists: true,
$ne: 'offline',
},
roles: {
$ne: 'bot',
},
},
{
roles: 'bot',
},
],
}),
statusLivechat: 'available',
};

const endReached = useCallback(
(start) => {
if (departmentsPhase !== AsyncStatePhase.LOADING) {
Expand Down Expand Up @@ -134,8 +112,10 @@ const ForwardChatModal = ({
<Field>
<FieldLabel>{t('Forward_to_user')}</FieldLabel>
<FieldRow>
<UserAutoComplete
conditions={conditions}
<AutoCompleteAgent
onlyAvailable
excludeId={room.servedBy?._id}
showIdleAgents={idleAgentsAllowedForForwarding}
placeholder={t('Username')}
onChange={(value) => {
setValue('username', value);
Expand Down

0 comments on commit b32b7f8

Please sign in to comment.