File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
src/app/organisms/invite-user Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments