Skip to content

Commit

Permalink
[FIX] Omnichannel Agents unable to take new chats in the queue (Rocke…
Browse files Browse the repository at this point in the history
…tChat#20022)

* Removing possibility of only managers to take queue chats.

* Fix Omnichannel permission default.

Make view-livechat-queue default form agents.

Co-authored-by: Renato Becker <[email protected]>
  • Loading branch information
2 people authored and mrsimpson committed Feb 2, 2021
1 parent 89c14f9 commit b9f9f79
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/authorization/server/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Meteor.startup(function() {
{ _id: 'save-others-livechat-room-info', roles: ['livechat-manager'] },
{ _id: 'remove-closed-livechat-rooms', roles: ['livechat-manager', 'admin'] },
{ _id: 'view-livechat-analytics', roles: ['livechat-manager', 'admin'] },
{ _id: 'view-livechat-queue', roles: ['livechat-manager', 'admin'] },
{ _id: 'view-livechat-queue', roles: ['livechat-agent', 'livechat-manager', 'admin'] },
{ _id: 'transfer-livechat-guest', roles: ['livechat-manager', 'admin'] },
{ _id: 'manage-livechat-managers', roles: ['livechat-manager', 'admin'] },
{ _id: 'manage-livechat-agents', roles: ['livechat-manager', 'admin'] },
Expand Down
4 changes: 2 additions & 2 deletions app/livechat/client/lib/stream/queueManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ const addGlobalListener = () => {
};


const subscribe = async (userId, isManager) => {
const subscribe = async (userId) => {
const config = await call('livechat:getRoutingConfig');
if (config && config.autoAssignAgent) {
return;
}

const agentDepartments = (await getAgentsDepartments(userId)).map((department) => department.departmentId);

const cleanUp = agentDepartments.length ? await addListenerForeachDepartment(agentDepartments) : isManager && addGlobalListener();
const cleanUp = agentDepartments.length ? await addListenerForeachDepartment(agentDepartments) : addGlobalListener();

updateInquiries(await getInquiriesFromAPI());

Expand Down
9 changes: 4 additions & 5 deletions client/providers/OmniChannelProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { OmnichannelContext, OmnichannelContextValue } from '../contexts/Omnicha
import { useReactiveValue } from '../hooks/useReactiveValue';
import { useUser, useUserId } from '../contexts/UserContext';
import { useMethodData, AsyncState } from '../contexts/ServerContext';
import { usePermission, useRole } from '../contexts/AuthorizationContext';
import { usePermission } from '../contexts/AuthorizationContext';
import { useSetting } from '../contexts/SettingsContext';
import { LivechatInquiry } from '../../app/livechat/client/collections/LivechatInquiry';
import { initializeLivechatInquiryStream } from '../../app/livechat/client/lib/stream/queueManager';
Expand All @@ -25,22 +25,21 @@ const emptyContext = {

const useOmnichannelInquiries = (): Array<any> => {
const uid = useUserId();
const isOmnichannelManger = useRole('livechat-manager');
const omnichannelPoolMaxIncoming = useSetting('Livechat_guest_pool_max_number_incoming_livechats_displayed') as number;
useEffect(() => {
const handler = async (): Promise<void> => {
initializeLivechatInquiryStream(uid, isOmnichannelManger);
initializeLivechatInquiryStream(uid);
};

(async (): Promise<void> => {
initializeLivechatInquiryStream(uid, isOmnichannelManger);
initializeLivechatInquiryStream(uid);
Notifications.onUser('departmentAgentData', handler);
})();

return (): void => {
Notifications.unUser('departmentAgentData', handler);
};
}, [isOmnichannelManger, uid]);
}, [uid]);

return useReactiveValue(useCallback(() => LivechatInquiry.find({
status: 'queued',
Expand Down

0 comments on commit b9f9f79

Please sign in to comment.