From 99b804d56732ad1cd4ea23a84ea31c04c2f88860 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Wed, 18 Sep 2019 13:02:52 +0100 Subject: [PATCH] Change to separate add and bind to guard 3PID account section This changes to checking for HS support of separate add and bind when guarding the 3PID account section. For older HSes, we in fact always require an IS for add with bind param, so the previous version of this was incorrect. Part of https://github.com/vector-im/riot-web/issues/10839 --- .../settings/tabs/user/GeneralUserSettingsTab.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js b/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js index b378db707a..b9c566b22a 100644 --- a/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js @@ -51,7 +51,7 @@ export default class GeneralUserSettingsTab extends React.Component { language: languageHandler.getCurrentLanguage(), theme: SettingsStore.getValueAt(SettingLevel.ACCOUNT, "theme"), haveIdServer: Boolean(MatrixClientPeg.get().getIdentityServerUrl()), - serverRequiresIdServer: null, + serverSupportsSeparateAddAndBind: null, idServerHasUnsignedTerms: false, requiredPolicyInfo: { // This object is passed along to a component for handling hasTerms: false, @@ -69,8 +69,8 @@ export default class GeneralUserSettingsTab extends React.Component { async componentWillMount() { const cli = MatrixClientPeg.get(); - const serverRequiresIdServer = await cli.doesServerRequireIdServerParam(); - this.setState({serverRequiresIdServer}); + const serverSupportsSeparateAddAndBind = await cli.doesServerSupportSeparateAddAndBind(); + this.setState({serverSupportsSeparateAddAndBind}); this._getThreepidState(); } @@ -222,7 +222,12 @@ export default class GeneralUserSettingsTab extends React.Component { let threepidSection = null; - if (this.state.haveIdServer || this.state.serverRequiresIdServer === false) { + // For older homeservers without separate 3PID add and bind methods (MSC2290), + // we use a combo add with bind option API which requires an identity server to + // validate 3PID ownership even if we're just adding to the homeserver only. + // For newer homeservers with separate 3PID add and bind methods (MSC2290), + // there is no such concern, so we can always show the HS account 3PIDs. + if (this.state.haveIdServer || this.state.serverSupportsSeparateAddAndBind === true) { threepidSection =
{_t("Email addresses")}
; - } else if (this.state.serverRequiresIdServer === null) { + } else if (this.state.serverSupportsSeparateAddAndBind === null) { threepidSection = ; }