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/saveLastVisitorMessageTs.js

12 lines
452 B

import { callbacks } from '../../../callbacks';
import { LivechatRooms } from '../../../models';
callbacks.add('afterSaveMessage', function(message, room) {
if (!(typeof room.t !== 'undefined' && room.t === 'l' && room.v && room.v.token)) {
return message;
}
if (message.token) {
LivechatRooms.setVisitorLastMessageTimestampByRoomId(room._id, message.ts);
}
return message;
}, callbacks.priority.HIGH, 'save-last-visitor-message-timestamp');