Use new flag in /versions

This commit is contained in:
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. // component without it.
matrixClient: null, matrixClient: null,
// the capabilities object from the server // whether the HS requires an ID server to register with a threepid
serverCaps: null, serverRequiresIdServer: null,
// The user ID we've just registered // The user ID we've just registered
registeredUsername: null, registeredUsername: null,
@ -212,17 +212,16 @@ module.exports = React.createClass({
idBaseUrl: isUrl, idBaseUrl: isUrl,
}); });
let caps = null; let serverRequiresIdServer = true;
try { try {
caps = await cli.getServerCapabilities(); serverRequiresIdServer = await cli.doesServerRequireIdServerParam();
caps = caps || {};
} catch (e) { } catch (e) {
console.log("Unable to fetch server capabilities", e); console.log("Unable to determine is server needs id_server param", e);
} }
this.setState({ this.setState({
matrixClient: cli, matrixClient: cli,
serverCaps: caps, serverRequiresIdServer,
busy: false, busy: false,
}); });
try { try {
@ -564,7 +563,7 @@ module.exports = React.createClass({
flows={this.state.flows} flows={this.state.flows}
serverConfig={this.props.serverConfig} serverConfig={this.props.serverConfig}
canSubmit={!this.state.serverErrorIsFatal} 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, flows: PropTypes.arrayOf(PropTypes.object).isRequired,
serverConfig: PropTypes.instanceOf(ValidatedServerConfig).isRequired, serverConfig: PropTypes.instanceOf(ValidatedServerConfig).isRequired,
canSubmit: PropTypes.bool, canSubmit: PropTypes.bool,
serverCapabilities: PropTypes.object, serverRequiresIdServer: PropTypes.bool,
}, },
getDefaultProps: function() { getDefaultProps: function() {
@ -437,9 +437,8 @@ module.exports = React.createClass({
}, },
_showEmail() { _showEmail() {
const idServerRequired = !this.props.serverCapabilities['me.dbkr.idomyownemail'];
const haveIs = Boolean(this.props.serverConfig.isUrl); 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 false;
} }
return true; return true;