Webhook cardDetails onRendered

Send webhook when cardDetails is rendered.
This commit is contained in:
jymcheong 2019-08-14 15:44:47 +08:00
parent 43d14f8b2b
commit 843478ac40
2 changed files with 34 additions and 5 deletions

View file

@ -117,6 +117,35 @@ BlazeComponent.extendComponent({
}, },
onRendered() { 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()) { if (!Utils.isMiniScreen()) {
Meteor.setTimeout(() => { Meteor.setTimeout(() => {
$('.card-details').mCustomScrollbar({ $('.card-details').mCustomScrollbar({

View file

@ -22,7 +22,7 @@ Meteor.methods({
let nodeVersion = process.version; let nodeVersion = process.version;
nodeVersion = nodeVersion.replace('v', ''); nodeVersion = nodeVersion.replace('v', '');
statistics.process = { statistics.process = {
nodeVersion: nodeVersion, nodeVersion,
pid: process.pid, pid: process.pid,
uptime: process.uptime(), uptime: process.uptime(),
}; };
@ -30,7 +30,7 @@ Meteor.methods({
let meteorVersion = Meteor.release; let meteorVersion = Meteor.release;
meteorVersion = meteorVersion.replace('METEOR@', ''); meteorVersion = meteorVersion.replace('METEOR@', '');
statistics.meteor = { statistics.meteor = {
meteorVersion: meteorVersion, meteorVersion,
}; };
// Thanks to RocketChat for MongoDB version detection ! // Thanks to RocketChat for MongoDB version detection !
// https://github.com/RocketChat/Rocket.Chat/blob/develop/app/utils/server/functions/getMongoInfo.js // https://github.com/RocketChat/Rocket.Chat/blob/develop/app/utils/server/functions/getMongoInfo.js
@ -59,9 +59,9 @@ Meteor.methods({
} }
} }
statistics.mongo = { statistics.mongo = {
mongoVersion: mongoVersion, mongoVersion,
mongoStorageEngine: mongoStorageEngine, mongoStorageEngine,
mongoOplogEnabled: mongoOplogEnabled, mongoOplogEnabled,
}; };
return statistics; return statistics;
}, },