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] Omnichannel Activity Monitor closing chats returned to the queue #21782

Merged
4 changes: 4 additions & 0 deletions app/livechat/server/lib/Livechat.js
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,10 @@ export const Livechat = {
throw new Meteor.Error('error-returning-inquiry', 'Error returning inquiry to the queue', { method: 'livechat:returnRoomAsInquiry' });
}

Meteor.defer(() => {
callbacks.run('livechat:afterReturnRoomAsInquiry', { room });
});

return true;
},

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { callbacks } from '../../../../../app/callbacks/server';
import { LivechatRooms } from '../../../../../app/models/server';
import { settings } from '../../../../../app/settings/server';

const afterReturnRoomAsInquiry = ({ room }: { room: any }): void => {
if (!room || !room._id || !room.omnichannel?.predictedVisitorAbandonmentAt) {
murtaza98 marked this conversation as resolved.
Show resolved Hide resolved
return;
}

(LivechatRooms as any).unsetPredictedVisitorAbandonmentByRoomId(room._id);
};

settings.get('Livechat_abandoned_rooms_action', (_, value) => {
if (!value || value === 'none') {
callbacks.remove('livechat:afterReturnRoomAsInquiry', 'livechat-after-return-room-as-inquiry');
return;
}
callbacks.add('livechat:afterReturnRoomAsInquiry', afterReturnRoomAsInquiry, callbacks.priority.HIGH, 'livechat-after-return-room-as-inquiry');
});
1 change: 1 addition & 0 deletions ee/app/livechat-enterprise/server/hooks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ import './onSaveVisitorInfo';
import './onBusinessHourStart';
import './onAgentAssignmentFailed';
import './afterOnHoldChatResumed';
import './afterReturnRoomAsInquiry';