From 182e59f2c016c7beb638d008f40147660ad0b5c4 Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Mon, 5 Oct 2015 08:54:25 -0400 Subject: Show/hide integrations properly based off config settings. --- .../user_settings/user_settings_integrations.jsx | 104 +++++++++++---------- .../user_settings/user_settings_modal.jsx | 2 +- 2 files changed, 55 insertions(+), 51 deletions(-) (limited to 'web/react/components') diff --git a/web/react/components/user_settings/user_settings_integrations.jsx b/web/react/components/user_settings/user_settings_integrations.jsx index bc5f36a51..231580cc3 100644 --- a/web/react/components/user_settings/user_settings_integrations.jsx +++ b/web/react/components/user_settings/user_settings_integrations.jsx @@ -34,60 +34,64 @@ export default class UserSettingsIntegrationsTab extends React.Component { let outgoingHooksSection; var inputs = []; - if (this.props.activeSection === 'incoming-hooks') { - inputs.push( - - ); + if (global.window.config.EnableIncomingWebhooks === 'true') { + if (this.props.activeSection === 'incoming-hooks') { + inputs.push( + + ); - incomingHooksSection = ( - { - this.updateSection(''); - e.preventDefault(); - }} - /> - ); - } else { - incomingHooksSection = ( - { - this.updateSection('incoming-hooks'); - }} - /> - ); + incomingHooksSection = ( + { + this.updateSection(''); + e.preventDefault(); + }} + /> + ); + } else { + incomingHooksSection = ( + { + this.updateSection('incoming-hooks'); + }} + /> + ); + } } - if (this.props.activeSection === 'outgoing-hooks') { - inputs.push( - - ); + if (global.window.config.EnableOutgoingWebhooks === 'true') { + if (this.props.activeSection === 'outgoing-hooks') { + inputs.push( + + ); - outgoingHooksSection = ( - { - this.updateSection(''); - e.preventDefault(); - }} - /> - ); - } else { - outgoingHooksSection = ( - { - this.updateSection('outgoing-hooks'); - }} - /> - ); + outgoingHooksSection = ( + { + this.updateSection(''); + e.preventDefault(); + }} + /> + ); + } else { + outgoingHooksSection = ( + { + this.updateSection('outgoing-hooks'); + }} + /> + ); + } } return ( diff --git a/web/react/components/user_settings/user_settings_modal.jsx b/web/react/components/user_settings/user_settings_modal.jsx index 692fb26ee..44cd423b5 100644 --- a/web/react/components/user_settings/user_settings_modal.jsx +++ b/web/react/components/user_settings/user_settings_modal.jsx @@ -38,7 +38,7 @@ export default class UserSettingsModal extends React.Component { if (global.window.config.EnableOAuthServiceProvider === 'true') { tabs.push({name: 'developer', uiName: 'Developer', icon: 'glyphicon glyphicon-th'}); } - if (global.window.config.EnableIncomingWebhooks === 'true') { + if (global.window.config.EnableIncomingWebhooks === 'true' || global.window.config.EnableOutgoingWebhooks === 'true') { tabs.push({name: 'integrations', uiName: 'Integrations', icon: 'glyphicon glyphicon-transfer'}); } tabs.push({name: 'display', uiName: 'Display', icon: 'glyphicon glyphicon-eye-open'}); -- cgit v1.2.3-1-g7c22