Restrict adding a server even when the number of servers is zero

This commit is contained in:
Yuya Ochiai
2017-11-07 22:18:24 +09:00
parent 4abd72856f
commit 878b5c1a42
4 changed files with 7 additions and 5 deletions

View File

@@ -343,7 +343,7 @@ const SettingsPage = createReactClass({
); );
var srvMgmt; var srvMgmt;
if (this.props.enableServerManagement || this.state.teams.length === 0) { if (this.props.enableServerManagement === true) {
srvMgmt = ( srvMgmt = (
<div> <div>
{serversRow} {serversRow}
@@ -518,7 +518,7 @@ const SettingsPage = createReactClass({
bsStyle='link' bsStyle='link'
style={settingsPage.close} style={settingsPage.close}
onClick={this.handleCancel} onClick={this.handleCancel}
disabled={this.state.teams.length === 0} disabled={settings.mergeDefaultTeams(this.state.teams).length === 0}
> >
<span>{'×'}</span> <span>{'×'}</span>
</Button> </Button>

View File

@@ -23,7 +23,7 @@ const teams = settings.mergeDefaultTeams(AppConfig.data.teams);
remote.getCurrentWindow().removeAllListeners('focus'); remote.getCurrentWindow().removeAllListeners('focus');
if (AppConfig.data.teams.length === 0) { if (teams.length === 0) {
window.location = 'settings.html'; window.location = 'settings.html';
} }

View File

@@ -69,7 +69,9 @@ module.exports = {
if (hasBuildConfigDefaultTeams(buildConfig)) { if (hasBuildConfigDefaultTeams(buildConfig)) {
newTeams.push(...JSON.parse(JSON.stringify(buildConfig.defaultTeams))); newTeams.push(...JSON.parse(JSON.stringify(buildConfig.defaultTeams)));
} }
newTeams.push(...JSON.parse(JSON.stringify(teams))); if (buildConfig.enableServerManagement) {
newTeams.push(...JSON.parse(JSON.stringify(teams)));
}
return newTeams; return newTeams;
} }
}; };

View File

@@ -40,7 +40,7 @@ function createTemplate(mainWindow, config, isDev) {
} }
}]; }];
if (buildConfig.enableServerManagement === true || config.teams.length === 0) { if (buildConfig.enableServerManagement === true) {
platformAppMenu.push({ platformAppMenu.push({
label: 'Sign in to Another Server', label: 'Sign in to Another Server',
click() { click() {