From 950e41e8f7894806cb6ad9b8f9285697b3739f85 Mon Sep 17 00:00:00 2001 From: n8ores Date: Thu, 18 Feb 2021 22:52:18 +1300 Subject: [PATCH] Fix bugs with customFields identified in Issue #3574 Fixed bug with the reference to the customFieldValue in the cards.js Activity Insert was not being passed the listId, swimlaneId which was required when building the webhook text string. Added customField and customFieldValue as default values for the webhook msgs. There is no good reason to exclude these (they will only be included when changing a customField anyway). Updated the docker-compose comment to reflect this change. --- docker-compose.yml | 2 +- models/activities.js | 4 +--- models/cards.js | 2 ++ server/notifications/outgoing.js | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index be2830c27..7eff8e493 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -309,7 +309,7 @@ services: #- TRUSTED_URL=https://intra.example.com #----------------------------------------------------------------- # ==== OUTGOING WEBHOOKS ==== - # What to send to Outgoing Webhook, or leave out. Example, that includes all that are default: cardId,listId,oldListId,boardId,comment,user,card,commentId . + # What to send to Outgoing Webhook, or leave out. If commented out the default values will be: cardId,listId,oldListId,boardId,comment,user,card,commentId,swimlaneId,customerField,customFieldValue #- WEBHOOKS_ATTRIBUTES=cardId,listId,oldListId,boardId,comment,user,card,commentId #----------------------------------------------------------------- # ==== Debug OIDC OAuth2 etc ==== diff --git a/models/activities.js b/models/activities.js index 5bd4ae4f7..1c98f7189 100644 --- a/models/activities.js +++ b/models/activities.js @@ -231,9 +231,7 @@ if (Meteor.isServer) { if (activity.customFieldId) { const customField = activity.customField(); params.customField = customField.name; - params.customFieldValue = Activities.findOne({ - customFieldId: customField._id, - }).value; + params.customFieldValue = activity.value; } // Label activity did not work yet, unable to edit labels when tried this. //if (activity.labelId) { diff --git a/models/cards.js b/models/cards.js index 28be0e989..de67063a2 100644 --- a/models/cards.js +++ b/models/cards.js @@ -2112,6 +2112,8 @@ function cardCustomFields(userId, doc, fieldNames, modifier) { activityType: 'setCustomField', boardId: doc.boardId, cardId: doc._id, + listId: doc.listId, + swimlaneId: doc.swimlaneId }; Activities.insert(act); } diff --git a/server/notifications/outgoing.js b/server/notifications/outgoing.js index 9a741ea1f..c2684efb2 100644 --- a/server/notifications/outgoing.js +++ b/server/notifications/outgoing.js @@ -61,6 +61,8 @@ if (Meteor.isServer) { 'card', 'commentId', 'swimlaneId', + 'customField', + 'customFieldValue' ]; const responseFunc = data => { const paramCommentId = data.commentId;