From 3da9b706329806cee114383760c5e6a9d1473f45 Mon Sep 17 00:00:00 2001 From: ginnyTheCat Date: Sun, 24 Apr 2022 18:29:50 +0200 Subject: [PATCH] Show devices without encryption support separately from unverified session (#499) * Show devices without encryption support separately * Fix typo * Don't show sessions without encryption support in red --- src/app/organisms/navigation/SideBar.jsx | 2 +- src/app/organisms/settings/DeviceManage.jsx | 19 ++++++++++++++++--- src/util/matrixUtil.js | 3 ++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/app/organisms/navigation/SideBar.jsx b/src/app/organisms/navigation/SideBar.jsx index eb20b72..5318696 100644 --- a/src/app/organisms/navigation/SideBar.jsx +++ b/src/app/organisms/navigation/SideBar.jsx @@ -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; diff --git a/src/app/organisms/settings/DeviceManage.jsx b/src/app/organisms/settings/DeviceManage.jsx index 5c60bf0..d7efd36 100644 --- a/src/app/organisms/settings/DeviceManage.jsx +++ b/src/app/organisms/settings/DeviceManage.jsx @@ -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 (
@@ -145,9 +152,15 @@ function DeviceManage() { { unverified.length > 0 ? unverified.map((device) => renderDevice(device, false)) - : No unverified session + : No unverified sessions }
+ {noEncryption.length > 0 && ( +
+ Sessions without encryption support + {noEncryption.map((device) => renderDevice(device, true))} +
+ )}
Verified sessions { diff --git a/src/util/matrixUtil.js b/src/util/matrixUtil.js index 1b67f7e..16be117 100644 --- a/src/util/matrixUtil.js +++ b/src/util/matrixUtil.js @@ -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; } }