Merge pull request #3896 from matrix-org/zip/11986-only-warn-unverified

Don't warn on unverified users; ensured behavior stays the same with flags off
pull/21833/head
Zoe 2020-01-22 11:44:14 +00:00 committed by GitHub
commit 684974372d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 1 deletions

View File

@ -70,6 +70,7 @@ const E2E_STATE = {
VERIFIED: "verified", VERIFIED: "verified",
WARNING: "warning", WARNING: "warning",
UNKNOWN: "unknown", UNKNOWN: "unknown",
NORMAL: "normal",
}; };
// Add all the Mjolnir stuff to the renderer // Add all the Mjolnir stuff to the renderer
@ -313,6 +314,22 @@ export default createReactClass({
return; return;
} }
// If cross-signing is off, the old behaviour is to scream at the user
// as if they've done something wrong, which they haven't
if (!SettingsStore.isFeatureEnabled("feature_cross_signing")) {
this.setState({
verified: E2E_STATE.WARNING,
}, this.props.onHeightChanged);
return;
}
if (!this.context.checkUserTrust(mxEvent.getSender()).isCrossSigningVerified()) {
this.setState({
verified: E2E_STATE.NORMAL,
}, this.props.onHeightChanged);
return;
}
const eventSenderTrust = await this.context.checkEventSenderTrust(mxEvent); const eventSenderTrust = await this.context.checkEventSenderTrust(mxEvent);
if (!eventSenderTrust) { if (!eventSenderTrust) {
this.setState({ this.setState({
@ -503,7 +520,9 @@ export default createReactClass({
// event is encrypted, display padlock corresponding to whether or not it is verified // event is encrypted, display padlock corresponding to whether or not it is verified
if (ev.isEncrypted()) { if (ev.isEncrypted()) {
if (this.state.verified === E2E_STATE.VERIFIED) { if (this.state.verified === E2E_STATE.NORMAL) {
return; // no icon if we've not even cross-signed the user
} else if (this.state.verified === E2E_STATE.VERIFIED) {
return; // no icon for verified return; // no icon for verified
} else if (this.state.verified === E2E_STATE.UNKNOWN) { } else if (this.state.verified === E2E_STATE.UNKNOWN) {
return (<E2ePadlockUnknown />); return (<E2ePadlockUnknown />);