From d85cf982cce263f15404db2a711eefa452b5c068 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Fri, 6 Aug 2021 17:34:21 +0530 Subject: [PATCH] Check if state_key is present Signed-off-by: RMidhunSuresh --- src/matrix/room/Room.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/matrix/room/Room.js b/src/matrix/room/Room.js index 0427799c..44ba536f 100644 --- a/src/matrix/room/Room.js +++ b/src/matrix/room/Room.js @@ -269,7 +269,7 @@ export class Room extends BaseRoom { } _getPowerLevelsEvent(roomResponse) { - const isPowerlevelEvent = event => event.type === POWERLEVELS_EVENT_TYPE; + const isPowerlevelEvent = event => event.state_key !== undefined && event.type === POWERLEVELS_EVENT_TYPE; const powerLevelEvent = roomResponse.timeline?.events.find(isPowerlevelEvent) ?? roomResponse.state?.events.find(isPowerlevelEvent); return powerLevelEvent; }