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
This commit is contained in:
J. Ryan Stinnett 2019-09-18 13:02:52 +01:00
parent 58c333f9c1
commit 99b804d567

View file

@ -51,7 +51,7 @@ export default class GeneralUserSettingsTab extends React.Component {
language: languageHandler.getCurrentLanguage(), language: languageHandler.getCurrentLanguage(),
theme: SettingsStore.getValueAt(SettingLevel.ACCOUNT, "theme"), theme: SettingsStore.getValueAt(SettingLevel.ACCOUNT, "theme"),
haveIdServer: Boolean(MatrixClientPeg.get().getIdentityServerUrl()), haveIdServer: Boolean(MatrixClientPeg.get().getIdentityServerUrl()),
serverRequiresIdServer: null, serverSupportsSeparateAddAndBind: null,
idServerHasUnsignedTerms: false, idServerHasUnsignedTerms: false,
requiredPolicyInfo: { // This object is passed along to a component for handling requiredPolicyInfo: { // This object is passed along to a component for handling
hasTerms: false, hasTerms: false,
@ -69,8 +69,8 @@ export default class GeneralUserSettingsTab extends React.Component {
async componentWillMount() { async componentWillMount() {
const cli = MatrixClientPeg.get(); const cli = MatrixClientPeg.get();
const serverRequiresIdServer = await cli.doesServerRequireIdServerParam(); const serverSupportsSeparateAddAndBind = await cli.doesServerSupportSeparateAddAndBind();
this.setState({serverRequiresIdServer}); this.setState({serverSupportsSeparateAddAndBind});
this._getThreepidState(); this._getThreepidState();
} }
@ -222,7 +222,12 @@ export default class GeneralUserSettingsTab extends React.Component {
let threepidSection = null; 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 = <div> threepidSection = <div>
<span className="mx_SettingsTab_subheading">{_t("Email addresses")}</span> <span className="mx_SettingsTab_subheading">{_t("Email addresses")}</span>
<EmailAddresses <EmailAddresses
@ -236,7 +241,7 @@ export default class GeneralUserSettingsTab extends React.Component {
onMsisdnsChange={this._onMsisdnsChange} onMsisdnsChange={this._onMsisdnsChange}
/> />
</div>; </div>;
} else if (this.state.serverRequiresIdServer === null) { } else if (this.state.serverSupportsSeparateAddAndBind === null) {
threepidSection = <Spinner />; threepidSection = <Spinner />;
} }