diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2016-03-28 16:17:17 -0400 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2016-03-29 15:18:48 -0400 |
commit | bb13476326b81191ba4aa854c25224638735272c (patch) | |
tree | 3c7e33af8ca5243aff5cfe1098c24a08f8805c7d /webapp/stores | |
parent | 3634b5bab55d16b4e30caa74d08db6a88e2dfbbf (diff) | |
download | chat-bb13476326b81191ba4aa854c25224638735272c.tar.gz chat-bb13476326b81191ba4aa854c25224638735272c.tar.bz2 chat-bb13476326b81191ba4aa854c25224638735272c.zip |
Added delete buttons to InstalledIntegrations
Diffstat (limited to 'webapp/stores')
-rw-r--r-- | webapp/stores/integration_store.jsx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/webapp/stores/integration_store.jsx b/webapp/stores/integration_store.jsx index b875c29e6..bf9f9ba85 100644 --- a/webapp/stores/integration_store.jsx +++ b/webapp/stores/integration_store.jsx @@ -51,6 +51,15 @@ class IntegrationStore extends EventEmitter { this.incomingWebhooks.push(incomingWebhook); } + removeIncomingWebhook(id) { + for (let i = 0; i < this.incomingWebhooks.length; i++) { + if (this.incomingWebhooks[i].id === id) { + this.incomingWebhooks.splice(i, 1); + break; + } + } + } + hasReceivedOutgoingWebhooks() { return this.receivedIncomingWebhooks; } @@ -68,6 +77,15 @@ class IntegrationStore extends EventEmitter { this.outgoingWebhooks.push(outgoingWebhook); } + removeOutgoingWebhook(id) { + for (let i = 0; i < this.outgoingWebhooks.length; i++) { + if (this.outgoingWebhooks[i].id === id) { + this.outgoingWebhooks.splice(i, 1); + break; + } + } + } + handleEventPayload(payload) { const action = payload.action; @@ -80,6 +98,10 @@ class IntegrationStore extends EventEmitter { this.addIncomingWebhook(action.incomingWebhook); this.emitChange(); break; + case ActionTypes.REMOVED_INCOMING_WEBHOOK: + this.removeIncomingWebhook(action.id); + this.emitChange(); + break; case ActionTypes.RECEIVED_OUTGOING_WEBHOOKS: this.setOutgoingWebhooks(action.outgoingWebhooks); this.emitChange(); @@ -88,6 +110,10 @@ class IntegrationStore extends EventEmitter { this.addOutgoingWebhook(action.outgoingWebhook); this.emitChange(); break; + case ActionTypes.REMOVED_OUTGOING_WEBHOOK: + this.removeOutgoingWebhook(action.id); + this.emitChange(); + break; } } } |