Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX][ENTERPRISE] Omnichannel agent is not leaving the room when a forwarded chat is queued #23404

Merged
merged 3 commits into from
Oct 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/livechat/server/lib/Helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,9 @@ export const forwardRoomToDepartment = async (room, guest, transferData) => {

Livechat.saveTransferHistory(room, transferData);
if (oldServedBy) {
RoutingManager.removeAllRoomSubscriptions(room, servedBy);
// if chat is queued then we don't ignore the new servedBy agent bcs at this
// point the chat is not assigned to him/her and it is still in the queue
RoutingManager.removeAllRoomSubscriptions(room, !chatQueued && servedBy);
murtaza98 marked this conversation as resolved.
Show resolved Hide resolved
}
if (!chatQueued && servedBy) {
Messages.createUserJoinWithRoomIdAndUser(rid, servedBy);
Expand All @@ -448,6 +450,8 @@ export const forwardRoomToDepartment = async (room, guest, transferData) => {
if (chatQueued) {
logger.debug(`Forwarding succesful. Marking inquiry ${ inquiry._id } as ready`);
LivechatInquiry.readyInquiry(inquiry._id);
LivechatRooms.removeAgentByRoomId(rid);
dispatchAgentDelegated(rid, null);
const newInquiry = LivechatInquiry.findOneById(inquiry._id);
await queueInquiry(room, newInquiry);

Expand Down