From af6e2c29eb0a8610fe218e8ec85e739433eac729 Mon Sep 17 00:00:00 2001
From: JoramWilander <jwawilander@gmail.com>
Date: Thu, 1 Oct 2015 14:07:20 -0400
Subject: Implement outgoing webhooks.

---
 .../user_settings/user_settings_integrations.jsx   | 39 +++++++++++++++++++---
 1 file changed, 35 insertions(+), 4 deletions(-)

(limited to 'web/react/components/user_settings/user_settings_integrations.jsx')

diff --git a/web/react/components/user_settings/user_settings_integrations.jsx b/web/react/components/user_settings/user_settings_integrations.jsx
index 3be062ad3..5711b8de2 100644
--- a/web/react/components/user_settings/user_settings_integrations.jsx
+++ b/web/react/components/user_settings/user_settings_integrations.jsx
@@ -4,6 +4,7 @@
 var SettingItemMin = require('../setting_item_min.jsx');
 var SettingItemMax = require('../setting_item_max.jsx');
 var ManageIncomingHooks = require('./manage_incoming_hooks.jsx');
+var ManageOutgoingHooks = require('./manage_outgoing_hooks.jsx');
 
 export default class UserSettingsIntegrationsTab extends React.Component {
     constructor(props) {
@@ -28,6 +29,7 @@ export default class UserSettingsIntegrationsTab extends React.Component {
     }
     render() {
         let incomingHooksSection;
+        let outgoingHooksSection;
         var inputs = [];
 
         if (this.props.activeSection === 'incoming-hooks') {
@@ -40,10 +42,10 @@ export default class UserSettingsIntegrationsTab extends React.Component {
                     title='Incoming Webhooks'
                     width = 'full'
                     inputs={inputs}
-                    updateSection={function clearSection(e) {
+                    updateSection={(e) => {
                         this.updateSection('');
                         e.preventDefault();
-                    }.bind(this)}
+                    }}
                 />
             );
         } else {
@@ -52,9 +54,36 @@ export default class UserSettingsIntegrationsTab extends React.Component {
                     title='Incoming Webhooks'
                     width = 'full'
                     describe='Manage your incoming webhooks (Developer feature)'
-                    updateSection={function updateNameSection() {
+                    updateSection={() => {
                         this.updateSection('incoming-hooks');
-                    }.bind(this)}
+                    }}
+                />
+            );
+        }
+
+        if (this.props.activeSection === 'outgoing-hooks') {
+            inputs.push(
+                <ManageOutgoingHooks />
+            );
+
+            outgoingHooksSection = (
+                <SettingItemMax
+                    title='Outgoing Webhooks'
+                    inputs={inputs}
+                    updateSection={(e) => {
+                        this.updateSection('');
+                        e.preventDefault();
+                    }}
+                />
+            );
+        } else {
+            outgoingHooksSection = (
+                <SettingItemMin
+                    title='Outgoing Webhooks'
+                    describe='Manage your outgoing webhooks'
+                    updateSection={() => {
+                        this.updateSection('outgoing-hooks');
+                    }}
                 />
             );
         }
@@ -82,6 +111,8 @@ export default class UserSettingsIntegrationsTab extends React.Component {
                     <h3 className='tab-header'>{'Integration Settings'}</h3>
                     <div className='divider-dark first'/>
                     {incomingHooksSection}
+                    <div className='divider-light'/>
+                    {outgoingHooksSection}
                     <div className='divider-dark'/>
                 </div>
             </div>
-- 
cgit v1.2.3-1-g7c22


From 5574151c8581211326b9ae4dbb400e70b083ecb9 Mon Sep 17 00:00:00 2001
From: JoramWilander <jwawilander@gmail.com>
Date: Fri, 2 Oct 2015 08:14:31 -0400
Subject: Fix postgres query and minor UI updates for outgoing webhooks.

---
 web/react/components/user_settings/user_settings_integrations.jsx | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'web/react/components/user_settings/user_settings_integrations.jsx')

diff --git a/web/react/components/user_settings/user_settings_integrations.jsx b/web/react/components/user_settings/user_settings_integrations.jsx
index 5711b8de2..bc5f36a51 100644
--- a/web/react/components/user_settings/user_settings_integrations.jsx
+++ b/web/react/components/user_settings/user_settings_integrations.jsx
@@ -20,6 +20,8 @@ export default class UserSettingsIntegrationsTab extends React.Component {
     }
     handleClose() {
         this.updateSection('');
+        $('.ps-container.modal-body').scrollTop(0);
+        $('.ps-container.modal-body').perfectScrollbar('update');
     }
     componentDidMount() {
         $('#user_settings').on('hidden.bs.modal', this.handleClose);
-- 
cgit v1.2.3-1-g7c22


From 182e59f2c016c7beb638d008f40147660ad0b5c4 Mon Sep 17 00:00:00 2001
From: JoramWilander <jwawilander@gmail.com>
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 +++++++++++----------
 1 file changed, 54 insertions(+), 50 deletions(-)

(limited to 'web/react/components/user_settings/user_settings_integrations.jsx')

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(
-                <ManageIncomingHooks />
-            );
+        if (global.window.config.EnableIncomingWebhooks === 'true') {
+            if (this.props.activeSection === 'incoming-hooks') {
+                inputs.push(
+                    <ManageIncomingHooks />
+                );
 
-            incomingHooksSection = (
-                <SettingItemMax
-                    title='Incoming Webhooks'
-                    width = 'full'
-                    inputs={inputs}
-                    updateSection={(e) => {
-                        this.updateSection('');
-                        e.preventDefault();
-                    }}
-                />
-            );
-        } else {
-            incomingHooksSection = (
-                <SettingItemMin
-                    title='Incoming Webhooks'
-                    width = 'full'
-                    describe='Manage your incoming webhooks (Developer feature)'
-                    updateSection={() => {
-                        this.updateSection('incoming-hooks');
-                    }}
-                />
-            );
+                incomingHooksSection = (
+                    <SettingItemMax
+                        title='Incoming Webhooks'
+                        width = 'full'
+                        inputs={inputs}
+                        updateSection={(e) => {
+                            this.updateSection('');
+                            e.preventDefault();
+                        }}
+                    />
+                );
+            } else {
+                incomingHooksSection = (
+                    <SettingItemMin
+                        title='Incoming Webhooks'
+                        width = 'full'
+                        describe='Manage your incoming webhooks (Developer feature)'
+                        updateSection={() => {
+                            this.updateSection('incoming-hooks');
+                        }}
+                    />
+                );
+            }
         }
 
-        if (this.props.activeSection === 'outgoing-hooks') {
-            inputs.push(
-                <ManageOutgoingHooks />
-            );
+        if (global.window.config.EnableOutgoingWebhooks === 'true') {
+            if (this.props.activeSection === 'outgoing-hooks') {
+                inputs.push(
+                    <ManageOutgoingHooks />
+                );
 
-            outgoingHooksSection = (
-                <SettingItemMax
-                    title='Outgoing Webhooks'
-                    inputs={inputs}
-                    updateSection={(e) => {
-                        this.updateSection('');
-                        e.preventDefault();
-                    }}
-                />
-            );
-        } else {
-            outgoingHooksSection = (
-                <SettingItemMin
-                    title='Outgoing Webhooks'
-                    describe='Manage your outgoing webhooks'
-                    updateSection={() => {
-                        this.updateSection('outgoing-hooks');
-                    }}
-                />
-            );
+                outgoingHooksSection = (
+                    <SettingItemMax
+                        title='Outgoing Webhooks'
+                        inputs={inputs}
+                        updateSection={(e) => {
+                            this.updateSection('');
+                            e.preventDefault();
+                        }}
+                    />
+                );
+            } else {
+                outgoingHooksSection = (
+                    <SettingItemMin
+                        title='Outgoing Webhooks'
+                        describe='Manage your outgoing webhooks'
+                        updateSection={() => {
+                            this.updateSection('outgoing-hooks');
+                        }}
+                    />
+                );
+            }
         }
 
         return (
-- 
cgit v1.2.3-1-g7c22

