summaryrefslogtreecommitdiffstats
path: root/webapp/stores
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/stores')
-rw-r--r--webapp/stores/integration_store.jsx26
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;
}
}
}