From b3b8d3c0860b6060a939a2f9405b2e8b594368ee Mon Sep 17 00:00:00 2001 From: Omar Sy Date: Wed, 22 Aug 2018 14:24:21 +0200 Subject: make the attributes that the webhook sends configurable --- server/notifications/outgoing.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/server/notifications/outgoing.js b/server/notifications/outgoing.js index 779d41a0..7e3ee60c 100644 --- a/server/notifications/outgoing.js +++ b/server/notifications/outgoing.js @@ -8,6 +8,8 @@ const postCatchError = Meteor.wrapAsync((url, options, resolve) => { }); }); +let webhooksAtbts = ( (process.env.WEBHOOKS_ATTRIBUTES && process.env.WEBHOOKS_ATTRIBUTES.split(',') ) || ['cardId', 'listId', 'oldListId', 'boardId', 'comment', 'user', 'card', 'commentId']); + Meteor.methods({ outgoingWebhooks(integrations, description, params) { check(integrations, Array); @@ -19,7 +21,7 @@ Meteor.methods({ if (quoteParams[key]) quoteParams[key] = `"${params[key]}"`; }); - const userId = (params.userId)?params.userId:integrations[0].userId; + const userId = (params.userId) ? params.userId : integrations[0].userId; const user = Users.findOne(userId); const text = `${params.user} ${TAPi18n.__(description, quoteParams, user.getLanguage())}\n${params.url}`; @@ -29,10 +31,7 @@ Meteor.methods({ text: `${text}`, }; - [ 'cardId', 'listId', 'oldListId', - 'boardId', 'comment', 'user', - 'card', 'commentId', - ].forEach((key) => { + webhooksAtbts.forEach((key) => { if (params[key]) value[key] = params[key]; }); value.description = description; -- cgit v1.2.3-1-g7c22 From fcbbb93bb663eec04e53230e447b2846f28d86e6 Mon Sep 17 00:00:00 2001 From: Omar Sy Date: Wed, 22 Aug 2018 15:07:46 +0200 Subject: change let to const --- server/notifications/outgoing.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/notifications/outgoing.js b/server/notifications/outgoing.js index 7e3ee60c..b35b3b2e 100644 --- a/server/notifications/outgoing.js +++ b/server/notifications/outgoing.js @@ -8,7 +8,7 @@ const postCatchError = Meteor.wrapAsync((url, options, resolve) => { }); }); -let webhooksAtbts = ( (process.env.WEBHOOKS_ATTRIBUTES && process.env.WEBHOOKS_ATTRIBUTES.split(',') ) || ['cardId', 'listId', 'oldListId', 'boardId', 'comment', 'user', 'card', 'commentId']); +const webhooksAtbts = ( (process.env.WEBHOOKS_ATTRIBUTES && process.env.WEBHOOKS_ATTRIBUTES.split(',') ) || ['cardId', 'listId', 'oldListId', 'boardId', 'comment', 'user', 'card', 'commentId']); Meteor.methods({ outgoingWebhooks(integrations, description, params) { -- cgit v1.2.3-1-g7c22