Check state_key is zero-length string

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-08-06 19:02:50 +05:30
parent d85cf982cc
commit 1a062f69fd

View file

@ -269,7 +269,7 @@ export class Room extends BaseRoom {
}
_getPowerLevelsEvent(roomResponse) {
const isPowerlevelEvent = event => event.state_key !== undefined && event.type === POWERLEVELS_EVENT_TYPE;
const isPowerlevelEvent = event => event.state_key === "" && event.type === POWERLEVELS_EVENT_TYPE;
const powerLevelEvent = roomResponse.timeline?.events.find(isPowerlevelEvent) ?? roomResponse.state?.events.find(isPowerlevelEvent);
return powerLevelEvent;
}