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/apps/meteor/app/livechat/server/hooks/saveContactLastChat.ts

26 lines
497 B

import { isOmnichannelRoom } from '@rocket.chat/core-typings';
import { callbacks } from '../../../../lib/callbacks';
import { Livechat } from '../lib/Livechat';
callbacks.add(
'livechat.newRoom',
async (room) => {
if (!isOmnichannelRoom(room)) {
return room;
}
const {
_id,
v: { _id: guestId },
} = room;
const lastChat = {
_id,
ts: new Date(),
};
await Livechat.updateLastChat(guestId, lastChat);
},
callbacks.priority.MEDIUM,
'livechat-save-last-chat',
);