Remove timeline reader and only use roomState

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-07-14 13:52:31 +05:30
parent 8a976ef24b
commit 22fab3761a

View file

@ -28,7 +28,6 @@ import {EventEntry} from "./timeline/entries/EventEntry.js";
import {ObservedEventMap} from "./ObservedEventMap.js"; import {ObservedEventMap} from "./ObservedEventMap.js";
import {DecryptionSource} from "../e2ee/common.js"; import {DecryptionSource} from "../e2ee/common.js";
import {ensureLogItem} from "../../logging/utils.js"; import {ensureLogItem} from "../../logging/utils.js";
import {TimelineReader} from "./timeline/persistence/TimelineReader.js";
import {PowerLevels} from "./timeline/PowerLevels.js"; import {PowerLevels} from "./timeline/PowerLevels.js";
import {RetainedObservableValue} from "../../observable/ObservableValue.js"; import {RetainedObservableValue} from "../../observable/ObservableValue.js";
@ -392,14 +391,7 @@ export class BaseRoom extends EventEmitter {
} }
async loadPowerLevels() { async loadPowerLevels() {
const timelineReader = new TimelineReader({ const txn = await this._storage.readTxn([this._storage.storeNames.roomState]);
roomId: this._roomId,
storage: this._storage,
fragmentIdComparer: this._fragmentIdComparer
});
const txn = await this._storage.readTxn(
timelineReader.readTxnStores.concat(this._storage.storeNames.roomMembers, this._storage.storeNames.roomState)
);
const powerLevelsState = await txn.roomState.get(this._roomId, "m.room.power_levels", ""); const powerLevelsState = await txn.roomState.get(this._roomId, "m.room.power_levels", "");
if (powerLevelsState) { if (powerLevelsState) {
return new PowerLevels({ return new PowerLevels({