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/api/server/helpers/composeRoomWithLastMessage.ts

11 lines
458 B

import { IRoom } from '../../../../definition/IRoom';
import { normalizeMessagesForUser } from '../../../utils/server/lib/normalizeMessagesForUser';
import { API } from '../api';
API.helperMethods.set('composeRoomWithLastMessage', function _composeRoomWithLastMessage(room: IRoom, userId: string) {
if (room.lastMessage) {
const [lastMessage] = normalizeMessagesForUser([room.lastMessage], userId);
room.lastMessage = lastMessage;
}
return room;
});