1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-29 16:43:09 +03:00

Don't create Olm sessions proactively

In what I hoped would be a five-minute refactor to help clean up an annoying
not-really-used codepath, but turned into a bit of a hackathon on the tests,
create Olm sessions lazily in Olm rooms, just as we do in megolm rooms, which
allows us to avoid having to get the member list before configuring e2e in a
room.
This commit is contained in:
Richard van der Hoff
2016-09-07 18:44:02 +01:00
parent 46a2073427
commit 1063a16013
5 changed files with 173 additions and 117 deletions

View File

@@ -453,18 +453,8 @@ MatrixClient.prototype.setRoomEncryption = function(roomId, config) {
if (!this._crypto) {
throw new Error("End-to-End encryption disabled");
}
var roomMembers = [];
var room = this.getRoom(roomId);
if (!room) {
console.warn("Enabling encryption in unknown room " + roomId);
} else {
roomMembers = utils.map(room.getJoinedMembers(), function(u) {
return u.userId;
});
}
return this._crypto.setRoomEncryption(roomId, config, roomMembers);
this._crypto.setRoomEncryption(roomId, config);
return q();
};
/**