From d37910c5ac2227ff11e159d9e616bcb95a152f9c Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Mon, 16 May 2022 13:53:14 +0530 Subject: [PATCH] Add getStateEvent in room --- src/matrix/Session.js | 1 - src/matrix/room/BaseRoom.js | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/matrix/Session.js b/src/matrix/Session.js index 41c8493c..cd676fc5 100644 --- a/src/matrix/Session.js +++ b/src/matrix/Session.js @@ -56,7 +56,6 @@ const PUSHER_KEY = "pusher"; export class Session { // sessionInfo contains deviceId, userId and homeserver constructor({storage, hsApi, sessionInfo, olm, olmWorker, platform, mediaRepository}) { - window.session = this this._platform = platform; this._storage = storage; this._hsApi = hsApi; diff --git a/src/matrix/room/BaseRoom.js b/src/matrix/room/BaseRoom.js index e7fb54d4..441146fb 100644 --- a/src/matrix/room/BaseRoom.js +++ b/src/matrix/room/BaseRoom.js @@ -73,6 +73,11 @@ export class BaseRoom extends EventEmitter { return value; } + async getStateEvent(type, key = '') { + const txn = await this._storage.readTxn(['roomState']); + return txn.roomState.get(this.id, type, key); + } + async _addStateObserver(stateObserver, txn) { if (!txn) { txn = await this._storage.readTxn([this._storage.storeNames.roomState]);