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
Этот коммит содержится в:
Poornima
2017-02-27 00:18:20 +05:30
коммит произвёл Joram Wilander
родитель c0bb6f99f8
Коммит 19b753467d
35 изменённых файлов: 1939 добавлений и 763 удалений

Просмотреть файл

@@ -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();