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

21 lines
713 B

import type { ISubscription, Serialized } from '@rocket.chat/core-typings';
export const mapSubscriptionFromApi = ({
ts,
lr,
ls,
_updatedAt,
oldRoomKeys,
suggestedOldRoomKeys,
abacLastTimeChecked,
...subscription
}: Serialized<ISubscription>): ISubscription => ({
...subscription,
ts: new Date(ts),
ls: new Date(ls),
lr: new Date(lr),
_updatedAt: new Date(_updatedAt),
...(abacLastTimeChecked && { abacLastTimeChecked: new Date(abacLastTimeChecked) }),
...(oldRoomKeys && { oldRoomKeys: oldRoomKeys.map(({ ts, ...key }) => ({ ...key, ts: new Date(ts) })) }),
...(suggestedOldRoomKeys && { suggestedOldRoomKeys: suggestedOldRoomKeys.map(({ ts, ...key }) => ({ ...key, ts: new Date(ts) })) }),
});