diff options
author | Poornima <mpoornima@users.noreply.github.com> | 2017-02-27 00:18:20 +0530 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2017-02-26 13:48:20 -0500 |
commit | 19b753467d37209f2227567637e60138d05dd405 (patch) | |
tree | 163ba0878c02267ecbbcb288e11d23e30ec9c8eb /webapp/stores/integration_store.jsx | |
parent | c0bb6f99f89259f6728856ace23d5dd505494b26 (diff) | |
download | chat-19b753467d37209f2227567637e60138d05dd405.tar.gz chat-19b753467d37209f2227567637e60138d05dd405.tar.bz2 chat-19b753467d37209f2227567637e60138d05dd405.zip |
Adding edit of incoming webhook (#5272)
Adding edit of outgoing webhook
Fixing spelling of error
Fixing style
Changing from PUT to POST for updates
Fixing test failures due to merge
Diffstat (limited to 'webapp/stores/integration_store.jsx')
-rw-r--r-- | webapp/stores/integration_store.jsx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/webapp/stores/integration_store.jsx b/webapp/stores/integration_store.jsx index 33680452b..34da3751a 100644 --- a/webapp/stores/integration_store.jsx +++ b/webapp/stores/integration_store.jsx @@ -57,6 +57,20 @@ class IntegrationStore extends EventEmitter { this.setIncomingWebhooks(teamId, incomingWebhooks); } + updateIncomingWebhook(incomingWebhook) { + const teamId = incomingWebhook.team_id; + const incomingWebhooks = this.getIncomingWebhooks(teamId); + + for (let i = 0; i < incomingWebhooks.length; i++) { + if (incomingWebhooks[i].id === incomingWebhook.id) { + incomingWebhooks[i] = incomingWebhook; + break; + } + } + + this.setIncomingWebhooks(teamId, incomingWebhooks); + } + removeIncomingWebhook(teamId, id) { let incomingWebhooks = this.getIncomingWebhooks(teamId); @@ -200,6 +214,10 @@ class IntegrationStore extends EventEmitter { this.addIncomingWebhook(action.incomingWebhook); this.emitChange(); break; + case ActionTypes.UPDATED_INCOMING_WEBHOOK: + this.updateIncomingWebhook(action.incomingWebhook); + this.emitChange(); + break; case ActionTypes.REMOVED_INCOMING_WEBHOOK: this.removeIncomingWebhook(action.teamId, action.id); this.emitChange(); |