Skip to content

Commit bc85626

Browse files
committed
Merge branch 'dev' of https://github.com/ajbura/cinny into dev
2 parents 06bae23 + 65a0edc commit bc85626

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/app/organisms/invite-user/InviteUser.jsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,18 @@ function InviteUser({
103103
updateIsSearching(false);
104104
}
105105

106+
async function hasDevices(userId) {
107+
try {
108+
const usersDeviceMap = await mx.downloadKeys([userId, mx.getUserId()]);
109+
return Object.values(usersDeviceMap).every((userDevices) =>
110+
Object.keys(userDevices).length > 0,
111+
);
112+
} catch (e) {
113+
console.error("Error determining if it's possible to encrypt to all users: ", e);
114+
return false;
115+
}
116+
}
117+
106118
async function createDM(userId) {
107119
if (mx.getUserId() === userId) return;
108120
const dmRoomId = hasDMWith(userId);
@@ -117,7 +129,7 @@ function InviteUser({
117129
procUserError.delete(userId);
118130
updateUserProcError(getMapCopy(procUserError));
119131

120-
const result = await roomActions.createDM(userId);
132+
const result = await roomActions.createDM(userId, await hasDevices(userId));
121133
roomIdToUserId.set(result.room_id, userId);
122134
updateRoomIdToUserId(getMapCopy(roomIdToUserId));
123135
} catch (e) {

0 commit comments

Comments
 (0)