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

11 lines
395 B

import type { IRoom } from '@rocket.chat/core-typings';
import { normalizeMessagesForUser } from '../../../utils/server/lib/normalizeMessagesForUser';
export async function composeRoomWithLastMessage(room: IRoom, userId: string) {
if (room.lastMessage) {
const [lastMessage] = await normalizeMessagesForUser([room.lastMessage], userId);
room.lastMessage = lastMessage;
}
return room;
}