Show devices without encryption support separately from unverified session (#499)
authorginnyTheCat <ginnythecat@lelux.net>
Sun, 24 Apr 2022 16:29:50 +0000 (18:29 +0200)
committerGitHub <noreply@github.com>
Sun, 24 Apr 2022 16:29:50 +0000 (21:59 +0530)
* Show devices without encryption support separately

* Fix typo

* Don't show sessions without encryption support in red

src/app/organisms/navigation/SideBar.jsx
src/app/organisms/settings/DeviceManage.jsx
src/util/matrixUtil.js

index eb20b72c654559a486f2e7f4c0c93d2125358b63..53186965685310b82d7541204c14372c91b081ec 100644 (file)
@@ -92,7 +92,7 @@ function ProfileAvatarMenu() {
 
 function CrossSigninAlert() {
   const deviceList = useDeviceList();
-  const unverified = deviceList?.filter((device) => !isCrossVerified(device.device_id));
+  const unverified = deviceList?.filter((device) => isCrossVerified(device.device_id) === false);
 
   if (!unverified?.length) return null;
 
index 5c60bf0a9427e2a682c07c7b8bfc7ebade19989a..d7efd362135ad351dc264d18c5c3b4617e8efd26 100644 (file)
@@ -124,9 +124,16 @@ function DeviceManage() {
 
   const unverified = [];
   const verified = [];
+  const noEncryption = [];
   deviceList.sort((a, b) => b.last_seen_ts - a.last_seen_ts).forEach((device) => {
-    if (isCrossVerified(device.device_id)) verified.push(device);
-    else unverified.push(device);
+    const isVerified = isCrossVerified(device.device_id);
+    if (isVerified === true) {
+      verified.push(device);
+    } else if (isVerified === false) {
+      unverified.push(device);
+    } else {
+      noEncryption.push(device);
+    }
   });
   return (
     <div className="device-manage">
@@ -145,9 +152,15 @@ function DeviceManage() {
         {
           unverified.length > 0
             ? unverified.map((device) => renderDevice(device, false))
-            : <Text className="device-manage__info">No unverified session</Text>
+            : <Text className="device-manage__info">No unverified sessions</Text>
         }
       </div>
+      {noEncryption.length > 0 && (
+      <div>
+        <MenuHeader>Sessions without encryption support</MenuHeader>
+        {noEncryption.map((device) => renderDevice(device, true))}
+      </div>
+      )}
       <div>
         <MenuHeader>Verified sessions</MenuHeader>
         {
index 1b67f7e682c6ff5137890399698ea44289143e0a..16be1175562e3a3f942837f814fcc874d2db828d 100644 (file)
@@ -171,7 +171,8 @@ export function isCrossVerified(deviceId) {
     const deviceTrust = crossSignInfo.checkDeviceTrust(crossSignInfo, deviceInfo, false, true);
     return deviceTrust.isCrossSigningVerified();
   } catch {
-    return false;
+    // device does not support encryption
+    return null;
   }
 }