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/client/lib/utils/mapMessageFromApi.ts

19 lines
477 B

import { IMessage } from '../../../definition/IMessage';
import { Serialized } from '../../../definition/Serialized';
export const mapMessageFromApi = ({
attachments = [],
tlm,
ts,
_updatedAt,
...message
}: Serialized<IMessage>): IMessage => ({
...message,
ts: new Date(ts),
...(tlm && { tlm: new Date(tlm) }),
_updatedAt: new Date(_updatedAt),
attachments: attachments.map(({ ts, ...attachment }) => ({
...(ts && { ts: new Date(ts) }),
...attachment,
})),
});