From 6572377832867879b2871fca4aff011b76e917e5 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 9 Nov 2020 16:50:39 +0100 Subject: [PATCH] move tracking the room to where we need the devices --- src/matrix/e2ee/RoomEncryption.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/matrix/e2ee/RoomEncryption.js b/src/matrix/e2ee/RoomEncryption.js index 4829a8d7..7a177f06 100644 --- a/src/matrix/e2ee/RoomEncryption.js +++ b/src/matrix/e2ee/RoomEncryption.js @@ -259,13 +259,11 @@ export class RoomEncryption { this._lastKeyPreShareTime = this._clock.createMeasure(); const roomKeyMessage = await this._megolmEncryption.ensureOutboundSession(this._room.id, this._encryptionParams); if (roomKeyMessage) { - await this._deviceTracker.trackRoom(this._room); await this._shareNewRoomKey(roomKeyMessage, hsApi); } } async encrypt(type, content, hsApi) { - await this._deviceTracker.trackRoom(this._room); const megolmResult = await this._megolmEncryption.encrypt(this._room.id, type, content, this._encryptionParams); if (megolmResult.roomKeyMessage) { // TODO: should we await this?? @@ -287,6 +285,7 @@ export class RoomEncryption { } async _shareNewRoomKey(roomKeyMessage, hsApi) { + await this._deviceTracker.trackRoom(this._room); const devices = await this._deviceTracker.devicesForTrackedRoom(this._room.id, hsApi); const userIds = Array.from(devices.reduce((set, device) => set.add(device.userId), new Set()));