diff --git a/src/VectorConferenceHandler.js b/src/VectorConferenceHandler.js index af6659d343d..9ba46b2ab6f 100644 --- a/src/VectorConferenceHandler.js +++ b/src/VectorConferenceHandler.js @@ -84,7 +84,7 @@ ConferenceCall.prototype._getConferenceUserRoom = function() { preset: "private_chat", invite: [this.confUserId] }).then(function(res) { - return new Room(res.room_id, client.getUserId()); + return new Room(res.room_id, null, client.getUserId()); }); }; diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 08bed976cc6..855090873f6 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -317,7 +317,7 @@ module.exports = React.createClass({ // lazy load members if enabled if (SettingsStore.isFeatureEnabled('feature_lazyloading')) { - MatrixClientPeg.get().loadRoomMembersIfNeeded(room.roomId).catch((err) => { + room.loadMembersIfNeeded().catch((err) => { const errorMessage = `Fetching room members for ${this.roomId} failed.` + " Room members will appear incomplete."; console.error(errorMessage); diff --git a/src/cryptodevices.js b/src/cryptodevices.js index 92237ce7f59..246fae3d738 100644 --- a/src/cryptodevices.js +++ b/src/cryptodevices.js @@ -43,27 +43,26 @@ export function markAllDevicesKnown(matrixClient, devices) { * @return {Promise} A promise which resolves to a map userId->deviceId->{@link * module:crypto~DeviceInfo|DeviceInfo}. */ -export function getUnknownDevicesForRoom(matrixClient, room) { - const roomMembers = room.getEncryptionTargetMembers().map((m) => { +export async function getUnknownDevicesForRoom(matrixClient, room) { + const roomMembers = await room.getEncryptionTargetMembers().map((m) => { return m.userId; }); - return matrixClient.downloadKeys(roomMembers, false).then((devices) => { - const unknownDevices = {}; - // This is all devices in this room, so find the unknown ones. - Object.keys(devices).forEach((userId) => { - Object.keys(devices[userId]).map((deviceId) => { - const device = devices[userId][deviceId]; + const devices = await matrixClient.downloadKeys(roomMembers, false); + const unknownDevices = {}; + // This is all devices in this room, so find the unknown ones. + Object.keys(devices).forEach((userId) => { + Object.keys(devices[userId]).map((deviceId) => { + const device = devices[userId][deviceId]; - if (device.isUnverified() && !device.isKnown()) { - if (unknownDevices[userId] === undefined) { - unknownDevices[userId] = {}; - } - unknownDevices[userId][deviceId] = device; + if (device.isUnverified() && !device.isKnown()) { + if (unknownDevices[userId] === undefined) { + unknownDevices[userId] = {}; } - }); + unknownDevices[userId][deviceId] = device; + } }); - return unknownDevices; }); + return unknownDevices; } function focusComposer() { diff --git a/test/components/views/rooms/RoomList-test.js b/test/components/views/rooms/RoomList-test.js index 8a596d41518..1e9f80f161a 100644 --- a/test/components/views/rooms/RoomList-test.js +++ b/test/components/views/rooms/RoomList-test.js @@ -23,7 +23,7 @@ function generateRoomId() { describe('RoomList', () => { function createRoom(opts) { - const room = new Room(generateRoomId(), client.getUserId()); + const room = new Room(generateRoomId(), null, client.getUserId()); if (opts) { Object.assign(room, opts); }