1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-30 02:21:17 +03:00

add helpers for beacon duration calculations (#8101)

* add helpers for beacon duration calculations

Signed-off-by: Kerry Archibald <kerrya@element.io>

* makeBeaconInfoEvent timestsamp prop

Signed-off-by: Kerry Archibald <kerrya@element.io>

* ad copyright

Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
Kerry
2022-03-22 11:46:47 +01:00
committed by GitHub
parent abc225d3c6
commit a80e55d38d
5 changed files with 145 additions and 3 deletions

View File

@ -24,6 +24,7 @@ type InfoContentProps = {
isLive?: boolean;
assetType?: LocationAssetType;
description?: string;
timestamp?: number;
};
const DEFAULT_INFO_CONTENT_PROPS: InfoContentProps = {
timeout: 3600000,
@ -43,7 +44,11 @@ export const makeBeaconInfoEvent = (
eventId?: string,
): MatrixEvent => {
const {
timeout, isLive, description, assetType,
timeout,
isLive,
description,
assetType,
timestamp,
} = {
...DEFAULT_INFO_CONTENT_PROPS,
...contentProps,
@ -52,7 +57,7 @@ export const makeBeaconInfoEvent = (
type: `${M_BEACON_INFO.name}.${sender}.${++count}`,
room_id: roomId,
state_key: sender,
content: makeBeaconInfoContent(timeout, isLive, description, assetType),
content: makeBeaconInfoContent(timeout, isLive, description, assetType, timestamp),
});
// live beacons use the beacon_info event id