From bd03db7674597b4f8a82202709c434fcb303a5fe Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 30 Mar 2018 16:51:10 -0600 Subject: [PATCH] Parse upstream travis-ci configurations correctly --- src/neb/NebProxy.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/neb/NebProxy.ts b/src/neb/NebProxy.ts index 02ead02..7f87e8e 100644 --- a/src/neb/NebProxy.ts +++ b/src/neb/NebProxy.ts @@ -20,6 +20,7 @@ interface InternalTravisCiConfig { [roomId: string]: { [repoKey: string]: { template: string; + addedByUserId: string; }; }; }; @@ -90,9 +91,14 @@ export class NebProxy { if (!result) result = {}; if (integration.type === "travisci") { - // Replace the webhook ID with the requesting user's webhook ID (generating it if needed) - result["webhookId"] = await this.getWebhookId(integration.type); - delete result["webhook_url"]; + let repos = result.rooms ? result.rooms[inRoomId] : {}; + if (!repos) repos = {}; + + // Replace the entire result to better represent how this should be sent + result = { + webhookId: await this.getWebhookId("travisci"), + repos: repos, + }; } return result; @@ -160,6 +166,7 @@ export class NebProxy { for (const repoKey of repoKeys) { result.rooms[roomId][repoKey] = { template: integration.config.rooms[roomId].repos[repoKey].template, + addedByUserId: userId, }; } }