From 91c97afb7c38a17137b3be1bcd9ee3cc1f1fa46c Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Fri, 15 Jan 2016 13:59:41 +0100 Subject: [PATCH 1/2] Small clean up for WebhookSettings --- .../ascribe_settings/webhook_settings.js | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/js/components/ascribe_settings/webhook_settings.js b/js/components/ascribe_settings/webhook_settings.js index 9deecbcd..51fb90a2 100644 --- a/js/components/ascribe_settings/webhook_settings.js +++ b/js/components/ascribe_settings/webhook_settings.js @@ -49,7 +49,7 @@ let WebhookSettings = React.createClass({ return (event) => { WebhookActions.removeWebhook(webhookId); - let notification = new GlobalNotificationModel(getLangText('Webhook deleted'), 'success', 2000); + const notification = new GlobalNotificationModel(getLangText('Webhook deleted'), 'success', 2000); GlobalNotificationActions.appendGlobalNotification(notification); }; }, @@ -57,16 +57,16 @@ let WebhookSettings = React.createClass({ handleCreateSuccess() { this.refs.webhookCreateForm.reset(); WebhookActions.fetchWebhooks(true); - let notification = new GlobalNotificationModel(getLangText('Webhook successfully created'), 'success', 5000); + + const notification = new GlobalNotificationModel(getLangText('Webhook successfully created'), 'success', 5000); GlobalNotificationActions.appendGlobalNotification(notification); }, - getWebhooks(){ - let content = ; - + getWebhooks() { if (this.state.webhooks) { - content = this.state.webhooks.map(function(webhook, i) { + return this.state.webhooks.map(function(webhook, i) { const event = webhook.event.split('.')[0]; + return ( - }/> + } /> ); }, this); + } else { + return ( + + ); } - return content; }, getEvents() { @@ -110,18 +113,18 @@ let WebhookSettings = React.createClass({ ); })} ); + } else { + return null; } - return null; }, - render() { return ( - +
- { this.getEvents() } + {this.getEvents()} + required />
@@ -162,4 +164,4 @@ let WebhookSettings = React.createClass({ } }); -export default WebhookSettings; \ No newline at end of file +export default WebhookSettings; From 31bec7f2f87e0910e26d4b1256dc3acba1eefa5f Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Fri, 15 Jan 2016 14:00:36 +0100 Subject: [PATCH 2/2] Remove extraneous call for fetching webhook events Successfully fetching the webhooks will fetch the events as well. --- js/components/ascribe_settings/webhook_settings.js | 1 - 1 file changed, 1 deletion(-) diff --git a/js/components/ascribe_settings/webhook_settings.js b/js/components/ascribe_settings/webhook_settings.js index 51fb90a2..4928c408 100644 --- a/js/components/ascribe_settings/webhook_settings.js +++ b/js/components/ascribe_settings/webhook_settings.js @@ -34,7 +34,6 @@ let WebhookSettings = React.createClass({ componentDidMount() { WebhookStore.listen(this.onChange); WebhookActions.fetchWebhooks(); - WebhookActions.fetchWebhookEvents(); }, componentWillUnmount() {