From 843478ac40b7718f1096a75295522487f0ca6dbe Mon Sep 17 00:00:00 2001 From: jymcheong Date: Wed, 14 Aug 2019 15:44:47 +0800 Subject: Webhook cardDetails onRendered Send webhook when cardDetails is rendered. --- client/components/cards/cardDetails.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'client/components/cards/cardDetails.js') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 781967ae..f52661b7 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -117,6 +117,35 @@ BlazeComponent.extendComponent({ }, onRendered() { + // Send Webhook but not create Activities records --- + const card = this.currentData(); + const userId = Meteor.userId(); + //console.log(`userId: ${userId}`); + //console.log(`cardId: ${card._id}`); + //console.log(`boardId: ${card.boardId}`); + //console.log(`listId: ${card.listId}`); + //console.log(`swimlaneId: ${card.swimlaneId}`); + const params = { + userId, + cardId: card._id, + boardId: card.boardId, + listId: card.listId, + user: Meteor.user().username, + url: '', + }; + //console.log('looking for integrations...'); + const integrations = Integrations.find({ + boardId: card.boardId, + type: 'outgoing-webhooks', + enabled: true, + activities: { $in: ['CardDetailsRendered', 'all'] }, + }).fetch(); + //console.log(`Investigation length: ${integrations.length}`); + if (integrations.length > 0) { + Meteor.call('outgoingWebhooks', integrations, 'CardSelected', params); + } + //------------- + if (!Utils.isMiniScreen()) { Meteor.setTimeout(() => { $('.card-details').mCustomScrollbar({ -- cgit v1.2.3-1-g7c22