Fix DM rooms are not being encrypted ()

* force check user device before creating dm

* fix getUserDeviceInfo doesn't exist on MatrixClient
This commit is contained in:
Ajay Bura 2025-03-24 20:08:11 +11:00 committed by GitHub
parent 649f70332b
commit 4aed4d7472
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);