From 263fed85e363c9ba2ec91baf2fcd882535e5e561 Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Tue, 28 Jun 2022 18:31:44 -0300 Subject: [PATCH] fix threads --- .../client/lib/utils/mapMessageFromApi.ts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/apps/meteor/client/lib/utils/mapMessageFromApi.ts b/apps/meteor/client/lib/utils/mapMessageFromApi.ts index 8c76575ac1de..69e80339b620 100644 --- a/apps/meteor/client/lib/utils/mapMessageFromApi.ts +++ b/apps/meteor/client/lib/utils/mapMessageFromApi.ts @@ -1,21 +1,16 @@ import type { IMessage } from '@rocket.chat/core-typings'; import { Serialized } from '@rocket.chat/core-typings'; -export const mapMessageFromApi = ({ - attachments = [], - tlm, - ts, - _updatedAt, - webRtcCallEndTs, - ...message -}: Serialized): IMessage => ({ +export const mapMessageFromApi = ({ attachments, tlm, ts, _updatedAt, webRtcCallEndTs, ...message }: Serialized): IMessage => ({ ...message, ts: new Date(ts), ...(tlm && { tlm: new Date(tlm) }), _updatedAt: new Date(_updatedAt), ...(webRtcCallEndTs && { webRtcCallEndTs: new Date(webRtcCallEndTs) }), - attachments: attachments.map(({ ts, ...attachment }) => ({ - ...(ts && { ts: new Date(ts) }), - ...attachment, - })), + ...(attachments && { + attachments: attachments.map(({ ts, ...attachment }) => ({ + ...(ts && { ts: new Date(ts) }), + ...attachment, + })), + }), });