Fix DM rooms are not being encrypted (#2286)
* force check user device before creating dm * fix getUserDeviceInfo doesn't exist on MatrixClient
This commit is contained in:
@@ -102,8 +102,9 @@ export function getIdServer(userId) {
|
|||||||
|
|
||||||
export async function hasDevices(mx, userId) {
|
export async function hasDevices(mx, userId) {
|
||||||
try {
|
try {
|
||||||
const usersDeviceMap = await mx.getUserDeviceInfo([userId, mx.getUserId()]);
|
const usersDeviceMap = await mx.getCrypto()?.getUserDeviceInfo([userId, mx.getUserId()], true);
|
||||||
return Object.values(usersDeviceMap)
|
|
||||||
|
return Array.from(usersDeviceMap.values())
|
||||||
.every((deviceIdToDevices) => deviceIdToDevices.size > 0);
|
.every((deviceIdToDevices) => deviceIdToDevices.size > 0);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Error determining if it's possible to encrypt to all users: ", e);
|
console.error("Error determining if it's possible to encrypt to all users: ", e);
|
||||||
|
|||||||
Reference in New Issue
Block a user