diff --git a/apps/meteor/ee/app/livechat-enterprise/server/services/omnichannel.internalService.ts b/apps/meteor/ee/app/livechat-enterprise/server/services/omnichannel.internalService.ts index 6e71528cd252d..96428ae85d5b2 100644 --- a/apps/meteor/ee/app/livechat-enterprise/server/services/omnichannel.internalService.ts +++ b/apps/meteor/ee/app/livechat-enterprise/server/services/omnichannel.internalService.ts @@ -35,9 +35,6 @@ export class OmnichannelEE extends ServiceClassInternal implements IOmnichannelE const canRoomBePlacedOnHold = !room.onHold; const canAgentPlaceOnHold = !room.lastMessage.token; const canPlaceChatOnHold = canRoomBePlacedOnHold && (!restrictedOnHold || canAgentPlaceOnHold); - if (!canPlaceChatOnHold) { - throw new Error('error-contact-sent-last-message-so-cannot-place-on-hold'); - } if (!room || !isOmnichannelRoom(room)) { throw new Error('error-invalid-room'); @@ -49,6 +46,10 @@ export class OmnichannelEE extends ServiceClassInternal implements IOmnichannelE throw new Error('error-room-is-already-on-hold'); } + if (!canPlaceChatOnHold) { + throw new Error('error-contact-sent-last-message-so-cannot-place-on-hold'); + } + if (!room.servedBy) { throw new Error('error-unserved-rooms-cannot-be-placed-onhold'); }