Use new flag in /versions

pull/21833/head
David Baker 2019-08-16 15:07:15 +01:00
parent 19c7a4627d
commit 41a9db3224
2 changed files with 9 additions and 11 deletions

View File

@ -98,8 +98,8 @@ module.exports = React.createClass({
// component without it.
matrixClient: null,
// the capabilities object from the server
serverCaps: null,
// whether the HS requires an ID server to register with a threepid
serverRequiresIdServer: null,
// The user ID we've just registered
registeredUsername: null,
@ -212,17 +212,16 @@ module.exports = React.createClass({
idBaseUrl: isUrl,
});
let caps = null;
let serverRequiresIdServer = true;
try {
caps = await cli.getServerCapabilities();
caps = caps || {};
serverRequiresIdServer = await cli.doesServerRequireIdServerParam();
} catch (e) {
console.log("Unable to fetch server capabilities", e);
console.log("Unable to determine is server needs id_server param", e);
}
this.setState({
matrixClient: cli,
serverCaps: caps,
serverRequiresIdServer,
busy: false,
});
try {
@ -564,7 +563,7 @@ module.exports = React.createClass({
flows={this.state.flows}
serverConfig={this.props.serverConfig}
canSubmit={!this.state.serverErrorIsFatal}
serverCapabilities={this.state.serverCaps}
serverRequiresIdServer={this.state.serverRequiresIdServer}
/>;
}
},

View File

@ -55,7 +55,7 @@ module.exports = React.createClass({
flows: PropTypes.arrayOf(PropTypes.object).isRequired,
serverConfig: PropTypes.instanceOf(ValidatedServerConfig).isRequired,
canSubmit: PropTypes.bool,
serverCapabilities: PropTypes.object,
serverRequiresIdServer: PropTypes.bool,
},
getDefaultProps: function() {
@ -437,9 +437,8 @@ module.exports = React.createClass({
},
_showEmail() {
const idServerRequired = !this.props.serverCapabilities['me.dbkr.idomyownemail'];
const haveIs = Boolean(this.props.serverConfig.isUrl);
if ((idServerRequired && !haveIs) || !this._authStepIsUsed('m.login.email.identity')) {
if ((this.props.serverRequiresIdServer && !haveIs) || !this._authStepIsUsed('m.login.email.identity')) {
return false;
}
return true;