mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
move tracking the room to where we need the devices
This commit is contained in:
parent
9cfb3c8e95
commit
6572377832
@ -259,13 +259,11 @@ export class RoomEncryption {
|
|||||||
this._lastKeyPreShareTime = this._clock.createMeasure();
|
this._lastKeyPreShareTime = this._clock.createMeasure();
|
||||||
const roomKeyMessage = await this._megolmEncryption.ensureOutboundSession(this._room.id, this._encryptionParams);
|
const roomKeyMessage = await this._megolmEncryption.ensureOutboundSession(this._room.id, this._encryptionParams);
|
||||||
if (roomKeyMessage) {
|
if (roomKeyMessage) {
|
||||||
await this._deviceTracker.trackRoom(this._room);
|
|
||||||
await this._shareNewRoomKey(roomKeyMessage, hsApi);
|
await this._shareNewRoomKey(roomKeyMessage, hsApi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async encrypt(type, content, 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);
|
const megolmResult = await this._megolmEncryption.encrypt(this._room.id, type, content, this._encryptionParams);
|
||||||
if (megolmResult.roomKeyMessage) {
|
if (megolmResult.roomKeyMessage) {
|
||||||
// TODO: should we await this??
|
// TODO: should we await this??
|
||||||
@ -287,6 +285,7 @@ export class RoomEncryption {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async _shareNewRoomKey(roomKeyMessage, hsApi) {
|
async _shareNewRoomKey(roomKeyMessage, hsApi) {
|
||||||
|
await this._deviceTracker.trackRoom(this._room);
|
||||||
const devices = await this._deviceTracker.devicesForTrackedRoom(this._room.id, hsApi);
|
const devices = await this._deviceTracker.devicesForTrackedRoom(this._room.id, hsApi);
|
||||||
const userIds = Array.from(devices.reduce((set, device) => set.add(device.userId), new Set()));
|
const userIds = Array.from(devices.reduce((set, device) => set.add(device.userId), new Set()));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user