Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
Remove all subscription from a chat placed on-hold.
Browse files Browse the repository at this point in the history
  • Loading branch information
renatobecker committed May 17, 2021
1 parent bf90764 commit d49c8fe
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@ const handleOnAgentAssignmentFailed = async ({ inquiry, room, options }: { inqui
}

if (room.onHold) {
const { _id: roomId, servedBy } = room;
const { _id: roomId } = room;

const { _id: inquiryId } = inquiry;
LivechatInquiry.readyInquiry(inquiryId);
LivechatInquiry.removeDefaultAgentById(inquiryId);
LivechatRooms.removeAgentByRoomId(roomId);
if (servedBy?._id) {
Subscriptions.removeByRoomIdAndUserId(roomId, servedBy._id);
}

Subscriptions.removeByRoomId(roomId);
const newInquiry = LivechatInquiry.findOneById(inquiryId);

await queueInquiry(room, newInquiry);
Expand Down

0 comments on commit d49c8fe

Please sign in to comment.