Use doMaybeLocalRoomAction (#9038)

* Use doMaybeLocalRoomAction

* Revert unnecessary changes
This commit is contained in:
Michael Weimann
2022-07-13 07:56:36 +02:00
committed by GitHub
parent 9b8b8763f7
commit 3be20cf434
12 changed files with 333 additions and 22 deletions
+4 -2
View File
@@ -44,6 +44,7 @@ import {
watchPosition,
} from "../utils/beacon";
import { getCurrentPosition } from "../utils/beacon";
import { doMaybeLocalRoomAction } from "../utils/local-room";
const isOwnBeacon = (beacon: Beacon, userId: string): boolean => beacon.beaconInfoOwner === userId;
@@ -399,9 +400,10 @@ export class OwnBeaconStore extends AsyncStoreWithClient<OwnBeaconStoreState> {
await Promise.all(existingLiveBeaconIdsForRoom.map(beaconId => this.stopBeacon(beaconId)));
// eslint-disable-next-line camelcase
const { event_id } = await this.matrixClient.unstable_createLiveBeacon(
const { event_id } = await doMaybeLocalRoomAction(
roomId,
beaconInfoContent,
(actualRoomId: string) => this.matrixClient.unstable_createLiveBeacon(actualRoomId, beaconInfoContent),
this.matrixClient,
);
storeLocallyCreateBeaconEventId(event_id);