Set E2E room status to warning when crypto is disabled

When crypto is disabled for the current device, we can't tell whether there are
unverified devices since we aren't tracking devices at all.

Let's be safe and default to the warning state.

See also https://github.com/matrix-org/matrix-js-sdk/pull/889
pull/21833/head
J. Ryan Stinnett 2019-04-08 16:26:54 +01:00
parent af83bdb317
commit 20c31082b5
1 changed files with 12 additions and 1 deletions

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",
});
});
},