await room.getEncryptionTargetMembers in cryptodevices
parent
1009bc43ae
commit
1f8e3e5d43
|
@ -43,27 +43,26 @@ export function markAllDevicesKnown(matrixClient, devices) {
|
||||||
* @return {Promise} A promise which resolves to a map userId->deviceId->{@link
|
* @return {Promise} A promise which resolves to a map userId->deviceId->{@link
|
||||||
* module:crypto~DeviceInfo|DeviceInfo}.
|
* module:crypto~DeviceInfo|DeviceInfo}.
|
||||||
*/
|
*/
|
||||||
export function getUnknownDevicesForRoom(matrixClient, room) {
|
export async function getUnknownDevicesForRoom(matrixClient, room) {
|
||||||
const roomMembers = room.getEncryptionTargetMembers().map((m) => {
|
const roomMembers = await room.getEncryptionTargetMembers().map((m) => {
|
||||||
return m.userId;
|
return m.userId;
|
||||||
});
|
});
|
||||||
return matrixClient.downloadKeys(roomMembers, false).then((devices) => {
|
const devices = await matrixClient.downloadKeys(roomMembers, false);
|
||||||
const unknownDevices = {};
|
const unknownDevices = {};
|
||||||
// This is all devices in this room, so find the unknown ones.
|
// This is all devices in this room, so find the unknown ones.
|
||||||
Object.keys(devices).forEach((userId) => {
|
Object.keys(devices).forEach((userId) => {
|
||||||
Object.keys(devices[userId]).map((deviceId) => {
|
Object.keys(devices[userId]).map((deviceId) => {
|
||||||
const device = devices[userId][deviceId];
|
const device = devices[userId][deviceId];
|
||||||
|
|
||||||
if (device.isUnverified() && !device.isKnown()) {
|
if (device.isUnverified() && !device.isKnown()) {
|
||||||
if (unknownDevices[userId] === undefined) {
|
if (unknownDevices[userId] === undefined) {
|
||||||
unknownDevices[userId] = {};
|
unknownDevices[userId] = {};
|
||||||
}
|
|
||||||
unknownDevices[userId][deviceId] = device;
|
|
||||||
}
|
}
|
||||||
});
|
unknownDevices[userId][deviceId] = device;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return unknownDevices;
|
|
||||||
});
|
});
|
||||||
|
return unknownDevices;
|
||||||
}
|
}
|
||||||
|
|
||||||
function focusComposer() {
|
function focusComposer() {
|
||||||
|
|
Loading…
Reference in New Issue