From a90e1471c632b54974ce8fdc62f45fe5409f6ad1 Mon Sep 17 00:00:00 2001 From: Dominik Henneke Date: Wed, 7 Sep 2022 13:50:32 +0200 Subject: [PATCH] Apply review comments --- src/stores/widgets/StopGapWidgetDriver.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/stores/widgets/StopGapWidgetDriver.ts b/src/stores/widgets/StopGapWidgetDriver.ts index 38b304bbdebe..9fbf5e4c5648 100644 --- a/src/stores/widgets/StopGapWidgetDriver.ts +++ b/src/stores/widgets/StopGapWidgetDriver.ts @@ -380,13 +380,10 @@ export class StopGapWidgetDriver extends WidgetDriver { direction?: 'f' | 'b', ): Promise { const client = MatrixClientPeg.get(); - const dir = - direction && Object.values(Direction as Record).includes(direction) - ? direction as Direction - : undefined; - const room = roomId !== undefined ? roomId : RoomViewStore.instance.getRoomId(); + const dir = direction as Direction; + roomId = roomId ?? RoomViewStore.instance.getRoomId() ?? undefined; - if (typeof room !== "string") { + if (typeof roomId !== "string") { throw new Error('Error while reading the current room'); } @@ -396,7 +393,7 @@ export class StopGapWidgetDriver extends WidgetDriver { nextBatch, prevBatch, } = await client.relations( - room, + roomId, eventId, relationType ?? null, eventType ?? null,