Skip to content
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);
}
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