From eed22e5dec5998dfddfd235b35194bd559cd9501 Mon Sep 17 00:00:00 2001 From: Kevin Aleman Date: Wed, 30 Jul 2025 22:07:51 -0600 Subject: [PATCH] fix: Remove room assignment before queueing the conversation again when transfering (#36577) --- .changeset/eleven-buses-return.md | 5 +++++ .../meteor/app/livechat/server/lib/RoutingManager.ts | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 .changeset/eleven-buses-return.md diff --git a/.changeset/eleven-buses-return.md b/.changeset/eleven-buses-return.md new file mode 100644 index 00000000000..6ecf152827c --- /dev/null +++ b/.changeset/eleven-buses-return.md @@ -0,0 +1,5 @@ +--- +"@rocket.chat/meteor": patch +--- + +Fixes an issue where rooms transferred to a department's queue could get stuck—marked as taken but with no agent assigned. \ No newline at end of file diff --git a/apps/meteor/app/livechat/server/lib/RoutingManager.ts b/apps/meteor/app/livechat/server/lib/RoutingManager.ts index 6d422819a88..be18f07b08f 100644 --- a/apps/meteor/app/livechat/server/lib/RoutingManager.ts +++ b/apps/meteor/app/livechat/server/lib/RoutingManager.ts @@ -180,6 +180,12 @@ export const RoutingManager: Routing = { const { servedBy } = room; + if (servedBy) { + await LivechatRooms.removeAgentByRoomId(rid); + await this.removeAllRoomSubscriptions(room); + await dispatchAgentDelegated(rid); + } + if (shouldQueue) { const queuedInquiry = await LivechatInquiry.queueInquiry(inquiry._id, room.lastMessage); if (queuedInquiry) { @@ -192,12 +198,6 @@ export const RoutingManager: Routing = { } } - if (servedBy) { - await LivechatRooms.removeAgentByRoomId(rid); - await this.removeAllRoomSubscriptions(room); - await dispatchAgentDelegated(rid); - } - await dispatchInquiryQueued(inquiry); return true;