Remove dead code for !withToggleButton in ServerConfig

This commit is contained in:
J. Ryan Stinnett 2019-01-24 15:07:49 -06:00
parent 0bee324e48
commit fa4ad21e0a
4 changed files with 20 additions and 31 deletions

View file

@ -211,7 +211,6 @@ module.exports = React.createClass({
if (!SdkConfig.get()['disable_custom_urls']) { if (!SdkConfig.get()['disable_custom_urls']) {
serverConfigSection = ( serverConfigSection = (
<ServerConfig ref="serverConfig" <ServerConfig ref="serverConfig"
withToggleButton={true}
defaultHsUrl={this.props.defaultHsUrl} defaultHsUrl={this.props.defaultHsUrl}
defaultIsUrl={this.props.defaultIsUrl} defaultIsUrl={this.props.defaultIsUrl}
customHsUrl={this.props.customHsUrl} customHsUrl={this.props.customHsUrl}

View file

@ -547,7 +547,6 @@ module.exports = React.createClass({
if (!SdkConfig.get()['disable_custom_urls']) { if (!SdkConfig.get()['disable_custom_urls']) {
serverConfig = <ServerConfig ref="serverConfig" serverConfig = <ServerConfig ref="serverConfig"
withToggleButton={true}
customHsUrl={this.state.discoveredHsUrl || this.props.customHsUrl} customHsUrl={this.state.discoveredHsUrl || this.props.customHsUrl}
customIsUrl={this.state.discoveredIsUrl || this.props.customIsUrl} customIsUrl={this.state.discoveredIsUrl || this.props.customIsUrl}
defaultHsUrl={this.props.defaultHsUrl} defaultHsUrl={this.props.defaultHsUrl}

View file

@ -330,7 +330,6 @@ module.exports = React.createClass({
if (!SdkConfig.get()['disable_custom_urls']) { if (!SdkConfig.get()['disable_custom_urls']) {
serverConfigSection = ( serverConfigSection = (
<ServerConfig ref="serverConfig" <ServerConfig ref="serverConfig"
withToggleButton={true}
customHsUrl={this.props.customHsUrl} customHsUrl={this.props.customHsUrl}
customIsUrl={this.props.customIsUrl} customIsUrl={this.props.customIsUrl}
defaultHsUrl={this.props.defaultHsUrl} defaultHsUrl={this.props.defaultHsUrl}

View file

@ -1,5 +1,6 @@
/* /*
Copyright 2015, 2016 OpenMarket Ltd Copyright 2015, 2016 OpenMarket Ltd
Copyright 2019 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -45,7 +46,6 @@ module.exports = React.createClass({
customHsUrl: PropTypes.string, customHsUrl: PropTypes.string,
customIsUrl: PropTypes.string, customIsUrl: PropTypes.string,
withToggleButton: PropTypes.bool,
delayTimeMs: PropTypes.number, // time to wait before invoking onChanged delayTimeMs: PropTypes.number, // time to wait before invoking onChanged
}, },
@ -54,7 +54,6 @@ module.exports = React.createClass({
onServerConfigChange: function() {}, onServerConfigChange: function() {},
customHsUrl: "", customHsUrl: "",
customIsUrl: "", customIsUrl: "",
withToggleButton: false,
delayTimeMs: 0, delayTimeMs: 0,
}; };
}, },
@ -63,9 +62,7 @@ module.exports = React.createClass({
return { return {
hs_url: this.props.customHsUrl, hs_url: this.props.customHsUrl,
is_url: this.props.customIsUrl, is_url: this.props.customIsUrl,
// if withToggleButton is false, then show the config all the time given we have no way otherwise of making it visible configVisible: (this.props.customHsUrl !== this.props.defaultHsUrl) ||
configVisible: !this.props.withToggleButton ||
(this.props.customHsUrl !== this.props.defaultHsUrl) ||
(this.props.customIsUrl !== this.props.defaultIsUrl), (this.props.customIsUrl !== this.props.defaultIsUrl),
}; };
}, },
@ -77,7 +74,7 @@ module.exports = React.createClass({
this.setState({ this.setState({
hs_url: newProps.customHsUrl, hs_url: newProps.customHsUrl,
is_url: newProps.customIsUrl, is_url: newProps.customIsUrl,
configVisible: !newProps.withToggleButton || configVisible:
(newProps.customHsUrl !== newProps.defaultHsUrl) || (newProps.customHsUrl !== newProps.defaultHsUrl) ||
(newProps.customIsUrl !== newProps.defaultIsUrl), (newProps.customIsUrl !== newProps.defaultIsUrl),
}); });
@ -146,26 +143,23 @@ module.exports = React.createClass({
const serverConfigStyle = {}; const serverConfigStyle = {};
serverConfigStyle.display = this.state.configVisible ? 'block' : 'none'; serverConfigStyle.display = this.state.configVisible ? 'block' : 'none';
let toggleButton; const toggleButton = (
if (this.props.withToggleButton) { <div className="mx_ServerConfig_selector">
toggleButton = ( <input className="mx_Login_radio" id="basic" name="configVisible" type="radio"
<div className="mx_ServerConfig_selector"> checked={!this.state.configVisible}
<input className="mx_Login_radio" id="basic" name="configVisible" type="radio" onChange={this.onServerConfigVisibleChange.bind(this, false)} />
checked={!this.state.configVisible} <label className="mx_Login_label" htmlFor="basic">
onChange={this.onServerConfigVisibleChange.bind(this, false)} /> { _t("Default server") }
<label className="mx_Login_label" htmlFor="basic"> </label>
{ _t("Default server") } &nbsp;&nbsp;
</label> <input className="mx_Login_radio" id="advanced" name="configVisible" type="radio"
&nbsp;&nbsp; checked={this.state.configVisible}
<input className="mx_Login_radio" id="advanced" name="configVisible" type="radio" onChange={this.onServerConfigVisibleChange.bind(this, true)} />
checked={this.state.configVisible} <label className="mx_Login_label" htmlFor="advanced">
onChange={this.onServerConfigVisibleChange.bind(this, true)} /> { _t("Custom server") }
<label className="mx_Login_label" htmlFor="advanced"> </label>
{ _t("Custom server") } </div>
</label> );
</div>
);
}
return ( return (
<div> <div>
@ -177,7 +171,6 @@ module.exports = React.createClass({
</label> </label>
<input className="mx_Login_field" id="hsurl" type="text" <input className="mx_Login_field" id="hsurl" type="text"
placeholder={this.props.defaultHsUrl} placeholder={this.props.defaultHsUrl}
disabled={!this.props.withToggleButton}
value={this.state.hs_url} value={this.state.hs_url}
onChange={this.onHomeserverChanged} /> onChange={this.onHomeserverChanged} />
<label className="mx_Login_label mx_ServerConfig_islabel" htmlFor="isurl"> <label className="mx_Login_label mx_ServerConfig_islabel" htmlFor="isurl">
@ -185,7 +178,6 @@ module.exports = React.createClass({
</label> </label>
<input className="mx_Login_field" id="isurl" type="text" <input className="mx_Login_field" id="isurl" type="text"
placeholder={this.props.defaultIsUrl} placeholder={this.props.defaultIsUrl}
disabled={!this.props.withToggleButton}
value={this.state.is_url} value={this.state.is_url}
onChange={this.onIdentityServerChanged} /> onChange={this.onIdentityServerChanged} />
<a className="mx_ServerConfig_help" href="#" onClick={this.showHelpPopup}> <a className="mx_ServerConfig_help" href="#" onClick={this.showHelpPopup}>