Move enableServerManagement key from defaultPreferences to buildConfig

This commit is contained in:
Yuya Ochiai 2017-11-07 22:06:42 +09:00
parent 51e6d5f039
commit 4abd72856f
6 changed files with 14 additions and 8 deletions

View file

@ -30,7 +30,8 @@ const CONFIG_TYPE_APP_OPTIONS = 'appOptions';
const SettingsPage = createReactClass({
propTypes: {
configFile: PropTypes.string
configFile: PropTypes.string,
enableServerManagement: PropTypes.bool
},
getInitialState() {
@ -342,7 +343,7 @@ const SettingsPage = createReactClass({
);
var srvMgmt;
if (this.state.enableServerManagement || this.state.teams.length === 0) {
if (this.props.enableServerManagement || this.state.teams.length === 0) {
srvMgmt = (
<div>
{serversRow}

View file

@ -169,7 +169,7 @@ ReactDOM.render(
useSpellChecker={AppConfig.data.useSpellChecker}
onSelectSpellCheckerLocale={handleSelectSpellCheckerLocale}
deeplinkingUrl={deeplinkingUrl}
showAddServerButton={AppConfig.data.enableServerManagement}
showAddServerButton={buildConfig.enableServerManagement}
requestingPermission={requestingPermission}
onClickPermissionDialog={handleClickPermissionDialog}
/>,

View file

@ -9,13 +9,17 @@ const React = require('react');
const ReactDOM = require('react-dom');
const SettingsPage = require('./components/SettingsPage.jsx');
const contextMenu = require('./js/contextMenu');
const buildConfig = require('../common/config/buildConfig');
const configFile = remote.app.getPath('userData') + '/config.json';
contextMenu.setup(remote.getCurrentWindow());
ReactDOM.render(
<SettingsPage configFile={configFile}/>,
<SettingsPage
configFile={configFile}
enableServerManagement={buildConfig.enableServerManagement}
/>,
document.getElementById('content')
);

View file

@ -5,6 +5,7 @@
* @prop {string} defaultTeams[].url - The URL for default team.
* @prop {string} helpLink - The URL for "Help->Learn More..." menu item.
* If null is specified, the menu disappears.
* @prop {boolean} enableServerManagement - Whether users can edit servers configuration.
*/
const buildConfig = {
defaultTeams: [/*
@ -13,7 +14,8 @@ const buildConfig = {
url: 'https://example.com'
}*/
],
helpLink: 'https://docs.mattermost.com/help/apps/desktop-guide.html'
helpLink: 'https://docs.mattermost.com/help/apps/desktop-guide.html',
enableServerManagement: true
};
module.exports = buildConfig;

View file

@ -13,8 +13,7 @@ const defaultPreferences = {
},
showUnreadBadge: true,
useSpellChecker: true,
spellCheckerLocale: 'en-US',
enableServerManagement: true
spellCheckerLocale: 'en-US'
};
module.exports = defaultPreferences;

View file

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