Merge pull request #2890 from jryans/guard-missing-crypto

Set E2E room status to warning when crypto is disabled
This commit is contained in:
J. Ryan Stinnett 2019-04-08 16:56:19 +01:00 committed by GitHub
commit 054011f5f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -730,8 +730,19 @@ module.exports = React.createClass({
if (!MatrixClientPeg.get().isRoomEncrypted(room.roomId)) {
return;
}
if (!MatrixClientPeg.get().isCryptoEnabled()) {
// If crypto is not currently enabled, we aren't tracking devices at all,
// so we don't know what the answer is. Let's error on the safe side and show
// a warning for this case.
this.setState({
e2eStatus: "warning",
});
return;
}
room.hasUnverifiedDevices().then((hasUnverifiedDevices) => {
this.setState({e2eStatus: hasUnverifiedDevices ? "warning" : "verified"});
this.setState({
e2eStatus: hasUnverifiedDevices ? "warning" : "verified",
});
});
},