mirror of
https://github.com/element-hq/element-web
synced 2024-11-23 09:46:09 +03:00
await room.getEncryptionTargetMembers in cryptodevices
This commit is contained in:
parent
1009bc43ae
commit
1f8e3e5d43
1 changed files with 14 additions and 15 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue