mirror of
https://github.com/wekan/wekan.git
synced 2025-04-23 13:37:09 -04:00
make the attributes that the webhook sends configurable
This commit is contained in:
parent
20757efc7e
commit
b3b8d3c086
1 changed files with 4 additions and 5 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue