From 4aed4d747282c67829ebfbf28fd1570413335a8a Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Mon, 24 Mar 2025 20:08:11 +1100 Subject: [PATCH] Fix DM rooms are not being encrypted (#2286) * force check user device before creating dm * fix getUserDeviceInfo doesn't exist on MatrixClient --- src/util/matrixUtil.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/util/matrixUtil.js b/src/util/matrixUtil.js index 0389177..19688a2 100644 --- a/src/util/matrixUtil.js +++ b/src/util/matrixUtil.js @@ -102,8 +102,9 @@ export function getIdServer(userId) { export async function hasDevices(mx, userId) { try { - const usersDeviceMap = await mx.getUserDeviceInfo([userId, mx.getUserId()]); - return Object.values(usersDeviceMap) + const usersDeviceMap = await mx.getCrypto()?.getUserDeviceInfo([userId, mx.getUserId()], true); + + return Array.from(usersDeviceMap.values()) .every((deviceIdToDevices) => deviceIdToDevices.size > 0); } catch (e) { console.error("Error determining if it's possible to encrypt to all users: ", e);