The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/app/livechat/server/hooks/sendTranscriptOnClose.js

19 lines
662 B

import { callbacks } from '../../../callbacks';
import { Livechat } from '../lib/Livechat';
import { LivechatRooms } from '../../../models';
const sendTranscriptOnClose = (room) => {
const { _id: rid, transcriptRequest, v: { token } = {} } = room;
if (!transcriptRequest || !token) {
return room;
}
const { email, subject, requestedBy: user } = transcriptRequest;
Livechat.sendTranscript({ token, rid, email, subject, user });
LivechatRooms.removeTranscriptRequestByRoomId(rid);
return LivechatRooms.findOneById(rid);
};
callbacks.add('livechat.closeRoom', sendTranscriptOnClose, callbacks.priority.HIGH, 'livechat-send-transcript-on-close-room');