show devices and unverify action also in unencrypted rooms

This commit is contained in:
Bruno Windels 2019-12-19 16:43:55 +00:00
parent b80bfd04b2
commit 8c5f3d6d94

View file

@ -1249,15 +1249,13 @@ const UserInfo = ({user, groupId, roomId, onClose}) => {
setDevices(null); setDevices(null);
} }
} }
if (isRoomEncrypted) { _downloadDeviceList();
_downloadDeviceList();
}
// Handle being unmounted // Handle being unmounted
return () => { return () => {
cancelled = true; cancelled = true;
}; };
}, [cli, user.userId, isRoomEncrypted]); }, [cli, user.userId]);
// Listen to changes // Listen to changes
useEffect(() => { useEffect(() => {
@ -1273,18 +1271,13 @@ const UserInfo = ({user, groupId, roomId, onClose}) => {
}); });
} }
}; };
cli.on("deviceVerificationChanged", onDeviceVerificationChanged);
if (isRoomEncrypted) {
cli.on("deviceVerificationChanged", onDeviceVerificationChanged);
}
// Handle being unmounted // Handle being unmounted
return () => { return () => {
cancel = true; cancel = true;
if (isRoomEncrypted) { cli.removeListener("deviceVerificationChanged", onDeviceVerificationChanged);
cli.removeListener("deviceVerificationChanged", onDeviceVerificationChanged);
}
}; };
}, [cli, user.userId, isRoomEncrypted]); }, [cli, user.userId]);
let text; let text;
if (!isRoomEncrypted) { if (!isRoomEncrypted) {
@ -1299,9 +1292,6 @@ const UserInfo = ({user, groupId, roomId, onClose}) => {
text = _t("Messages in this room are end-to-end encrypted."); text = _t("Messages in this room are end-to-end encrypted.");
} }
const devicesSection = isRoomEncrypted ?
(<DevicesSection loading={devices === undefined} devices={devices} userId={user.userId} />) : null;
const userVerified = cli.checkUserTrust(user.userId).isVerified(); const userVerified = cli.checkUserTrust(user.userId).isVerified();
let verifyButton; let verifyButton;
if (!userVerified) { if (!userVerified) {
@ -1310,6 +1300,10 @@ const UserInfo = ({user, groupId, roomId, onClose}) => {
</AccessibleButton>; </AccessibleButton>;
} }
const devicesSection = <DevicesSection
loading={devices === undefined}
devices={devices} userId={user.userId} />;
const securitySection = ( const securitySection = (
<div className="mx_UserInfo_container"> <div className="mx_UserInfo_container">
<h3>{ _t("Security") }</h3> <h3>{ _t("Security") }</h3>