From 46f448899bf715fa2b557562a6a01d80ca4fc6b4 Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Thu, 22 Oct 2015 14:16:51 -0400 Subject: In webhooks UI handle error if channel can't be found, also use display name over url name, plus warning fixes --- .../user_settings/manage_incoming_hooks.jsx | 52 +++++++++++++--------- .../user_settings/manage_outgoing_hooks.jsx | 32 +++++++++++-- .../user_settings/user_settings_integrations.jsx | 4 +- 3 files changed, 62 insertions(+), 26 deletions(-) (limited to 'web') diff --git a/web/react/components/user_settings/manage_incoming_hooks.jsx b/web/react/components/user_settings/manage_incoming_hooks.jsx index f5a2774a0..812169be4 100644 --- a/web/react/components/user_settings/manage_incoming_hooks.jsx +++ b/web/react/components/user_settings/manage_incoming_hooks.jsx @@ -96,7 +96,14 @@ export default class ManageIncomingHooks extends React.Component { const options = []; channels.forEach((channel) => { if (channel.type !== Constants.DM_CHANNEL) { - options.push(); + options.push( + + ); } }); @@ -108,26 +115,31 @@ export default class ManageIncomingHooks extends React.Component { const hooks = []; this.state.hooks.forEach((hook) => { const c = ChannelStore.get(hook.channel_id); - hooks.push( -
-
-
- {'URL: '}{Utils.getWindowLocationOrigin() + '/hooks/' + hook.id} -
-
- {'Channel: '}{c.name} -
-
- - {'Remove'} - + if (c) { + hooks.push( +
+
+
+ {'URL: '}{Utils.getWindowLocationOrigin() + '/hooks/' + hook.id} +
+
+ {'Channel: '}{c.display_name} +
+
+ + {'Remove'} + +
-
- ); + ); + } }); let displayHooks; diff --git a/web/react/components/user_settings/manage_outgoing_hooks.jsx b/web/react/components/user_settings/manage_outgoing_hooks.jsx index e83ae3bd6..f6d6b515b 100644 --- a/web/react/components/user_settings/manage_outgoing_hooks.jsx +++ b/web/react/components/user_settings/manage_outgoing_hooks.jsx @@ -128,21 +128,42 @@ export default class ManageOutgoingHooks extends React.Component { } const channels = ChannelStore.getAll(); - const options = []; + const options = []; + options.push( + + ); + channels.forEach((channel) => { if (channel.type === Constants.OPEN_CHANNEL) { - options.push(); + options.push( + + ); } }); const hooks = []; this.state.hooks.forEach((hook) => { const c = ChannelStore.get(hook.channel_id); + + if (!c && hook.channel_id && hook.channel_id.length !== 0) { + return; + } + let channelDiv; if (c) { channelDiv = (
- {'Channel: '}{c.name} + {'Channel: '}{c.display_name}
); } @@ -157,7 +178,10 @@ export default class ManageOutgoingHooks extends React.Component { } hooks.push( -
+
{'URLs: '}{hook.callback_urls.join(', ')} diff --git a/web/react/components/user_settings/user_settings_integrations.jsx b/web/react/components/user_settings/user_settings_integrations.jsx index 231580cc3..1845ca28c 100644 --- a/web/react/components/user_settings/user_settings_integrations.jsx +++ b/web/react/components/user_settings/user_settings_integrations.jsx @@ -37,7 +37,7 @@ export default class UserSettingsIntegrationsTab extends React.Component { if (global.window.config.EnableIncomingWebhooks === 'true') { if (this.props.activeSection === 'incoming-hooks') { inputs.push( - + ); incomingHooksSection = ( @@ -68,7 +68,7 @@ export default class UserSettingsIntegrationsTab extends React.Component { if (global.window.config.EnableOutgoingWebhooks === 'true') { if (this.props.activeSection === 'outgoing-hooks') { inputs.push( - + ); outgoingHooksSection = ( -- cgit v1.2.3-1-g7c22