don't trip over missing create events when loading power levels

as the test from previous commit fails because of that, and powerlevels
works fine without
This commit is contained in:
Bruno Windels 2021-06-02 18:41:52 +02:00
parent 4a8a6168cd
commit 84ecaa2ee1

View file

@ -84,10 +84,14 @@ export class Timeline {
}); });
} }
const createState = await txn.roomState.get(this._roomId, "m.room.create", ""); const createState = await txn.roomState.get(this._roomId, "m.room.create", "");
return new PowerLevels({ if (createState) {
createEvent: createState.event, return new PowerLevels({
ownUserId: this._ownMember.userId createEvent: createState.event,
}); ownUserId: this._ownMember.userId
});
} else {
return new PowerLevels({ownUserId: this._ownMember.userId});
}
} }
_setupEntries(timelineEntries) { _setupEntries(timelineEntries) {