summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-07-13 01:35:49 +0900
committerGitHub <noreply@github.com>2017-07-13 01:35:49 +0900
commitd3506c9d69e25f67109ffaae4ebc32e79a61244d (patch)
treea0f61a56f17bbd8b511d265e55cb4332a0ced32a /webapp
parentb1322746d2ceb5b840b4ad0d3ffc770f6b73d83b (diff)
downloadchat-d3506c9d69e25f67109ffaae4ebc32e79a61244d.tar.gz
chat-d3506c9d69e25f67109ffaae4ebc32e79a61244d.tar.bz2
chat-d3506c9d69e25f67109ffaae4ebc32e79a61244d.zip
fix JS error on SpinnerButton and refactor edit incoming/outgoing webhook (#6917)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/components/integrations/components/edit_incoming_webhook.jsx10
-rw-r--r--webapp/components/integrations/components/edit_outgoing_webhook.jsx23
-rw-r--r--webapp/components/spinner_button.jsx6
3 files changed, 19 insertions, 20 deletions
diff --git a/webapp/components/integrations/components/edit_incoming_webhook.jsx b/webapp/components/integrations/components/edit_incoming_webhook.jsx
index 5a6309212..00cb50cbd 100644
--- a/webapp/components/integrations/components/edit_incoming_webhook.jsx
+++ b/webapp/components/integrations/components/edit_incoming_webhook.jsx
@@ -31,13 +31,11 @@ export default class EditIncomingWebhook extends AbstractIncomingWebhook {
handleIntegrationChange() {
const teamId = TeamStore.getCurrentId();
- this.setState({
- hooks: IntegrationStore.getIncomingWebhooks(teamId),
- loading: !IntegrationStore.hasReceivedIncomingWebhooks(teamId)
- });
+ const hooks = IntegrationStore.getIncomingWebhooks(teamId);
+ const loading = !IntegrationStore.hasReceivedIncomingWebhooks(teamId);
- if (!this.state.loading) {
- this.originalIncomingHook = this.state.hooks.filter((hook) => hook.id === this.props.location.query.id)[0];
+ if (!loading) {
+ this.originalIncomingHook = hooks.filter((hook) => hook.id === this.props.location.query.id)[0];
this.setState({
displayName: this.originalIncomingHook.display_name,
diff --git a/webapp/components/integrations/components/edit_outgoing_webhook.jsx b/webapp/components/integrations/components/edit_outgoing_webhook.jsx
index 2b6776b28..2f56d1eae 100644
--- a/webapp/components/integrations/components/edit_outgoing_webhook.jsx
+++ b/webapp/components/integrations/components/edit_outgoing_webhook.jsx
@@ -43,21 +43,11 @@ export default class EditOutgoingWebhook extends AbstractOutgoingWebhook {
handleIntegrationChange() {
const teamId = TeamStore.getCurrentId();
- this.setState({
- hooks: IntegrationStore.getOutgoingWebhooks(teamId),
- loading: !IntegrationStore.hasReceivedOutgoingWebhooks(teamId)
- });
+ const hooks = IntegrationStore.getOutgoingWebhooks(teamId);
+ const loading = !IntegrationStore.hasReceivedOutgoingWebhooks(teamId);
- if (!this.state.loading) {
- this.originalOutgoingHook = this.state.hooks.filter((hook) => hook.id === this.props.location.query.id)[0];
-
- this.setState({
- displayName: this.originalOutgoingHook.display_name,
- description: this.originalOutgoingHook.description,
- channelId: this.originalOutgoingHook.channel_id,
- contentType: this.originalOutgoingHook.content_type,
- triggerWhen: this.originalOutgoingHook.trigger_when
- });
+ if (!loading) {
+ this.originalOutgoingHook = hooks.filter((hook) => hook.id === this.props.location.query.id)[0];
var triggerWords = '';
if (this.originalOutgoingHook.trigger_words) {
@@ -76,6 +66,11 @@ export default class EditOutgoingWebhook extends AbstractOutgoingWebhook {
}
this.setState({
+ displayName: this.originalOutgoingHook.display_name,
+ description: this.originalOutgoingHook.description,
+ channelId: this.originalOutgoingHook.channel_id,
+ contentType: this.originalOutgoingHook.content_type,
+ triggerWhen: this.originalOutgoingHook.trigger_when,
triggerWords,
callbackUrls
});
diff --git a/webapp/components/spinner_button.jsx b/webapp/components/spinner_button.jsx
index 78079b2b4..b3b291ff8 100644
--- a/webapp/components/spinner_button.jsx
+++ b/webapp/components/spinner_button.jsx
@@ -16,6 +16,12 @@ export default class SpinnerButton extends React.Component {
};
}
+ static get defaultProps() {
+ return {
+ spinning: false
+ };
+ }
+
render() {
const {spinning, children, ...props} = this.props; // eslint-disable-line no-use-before-define