mirror of
https://github.com/wekan/wekan.git
synced 2026-03-04 04:40:16 +01:00
Add Feature: enable two-way webhooks - stage two
This commit is contained in:
parent
3f0600fed7
commit
dd0682328b
4 changed files with 103 additions and 26 deletions
|
|
@ -184,10 +184,11 @@ if (Meteor.isServer) {
|
|||
// it's person at himself, ignore it?
|
||||
continue;
|
||||
}
|
||||
const user = Users.findOne(username) || Users.findOne({ username });
|
||||
const uid = user && user._id;
|
||||
const atUser =
|
||||
Users.findOne(username) || Users.findOne({ username });
|
||||
const uid = atUser && atUser._id;
|
||||
params.atUsername = username;
|
||||
params.atEmails = user.emails;
|
||||
params.atEmails = atUser.emails;
|
||||
if (board.hasMember(uid)) {
|
||||
title = 'act-atUserComment';
|
||||
watchers = _.union(watchers, [uid]);
|
||||
|
|
@ -268,13 +269,23 @@ if (Meteor.isServer) {
|
|||
});
|
||||
|
||||
const integrations = Integrations.find({
|
||||
boardId: board._id,
|
||||
type: 'outgoing-webhooks',
|
||||
boardId: { $in: [board._id, Integrations.Const.GLOBAL_WEBHOOK_ID] },
|
||||
// type: 'outgoing-webhooks', // all types
|
||||
enabled: true,
|
||||
activities: { $in: [description, 'all'] },
|
||||
}).fetch();
|
||||
if (integrations.length > 0) {
|
||||
Meteor.call('outgoingWebhooks', integrations, description, params);
|
||||
integrations.forEach(integration => {
|
||||
Meteor.call(
|
||||
'outgoingWebhooks',
|
||||
integration,
|
||||
description,
|
||||
params,
|
||||
() => {
|
||||
return;
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,11 @@ Integrations.attachSchema(
|
|||
);
|
||||
Integrations.Const = {
|
||||
GLOBAL_WEBHOOK_ID: '_global',
|
||||
WEBHOOK_TYPES: ['outgoing-webhooks', 'bidirectional-webhooks'],
|
||||
ONEWAY: 'outgoing-webhooks',
|
||||
TWOWAY: 'bidirectional-webhooks',
|
||||
get WEBHOOK_TYPES() {
|
||||
return [this.ONEWAY, this.TWOWAY];
|
||||
},
|
||||
};
|
||||
const permissionHelper = {
|
||||
allow(userId, doc) {
|
||||
|
|
|
|||
|
|
@ -147,7 +147,6 @@ if (Meteor.isServer) {
|
|||
}:${doc.mailServer.port}/`;
|
||||
}
|
||||
Accounts.emailTemplates.from = doc.mailServer.from;
|
||||
console.log('Settings saved:', Accounts.emailTemplates);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue