1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-20 13:49:43 +02:00

feat: Webhooks configuration, all events support, refactoring

This commit is contained in:
Maksim Eltyshev 2024-06-12 00:51:36 +02:00
parent 3779bdb053
commit c065566c15
96 changed files with 1280 additions and 509 deletions

View file

@ -27,6 +27,10 @@ module.exports = {
custom: valuesValidator,
required: true,
},
actorUser: {
type: 'ref',
required: true,
},
request: {
type: 'ref',
},
@ -84,21 +88,12 @@ module.exports = {
);
});
/* The user could be created manually by an user or via OIDC. We hijack the id field, so one can differentiate between the two on the webhook side. */
let initiator;
if (inputs.request && inputs.request.currentUser) {
initiator = inputs.request.currentUser;
} else {
initiator = {
id: 'oidc',
};
}
await sails.helpers.utils.sendWebhook.with({
event: 'USER_CREATE',
data: { ...user, password: undefined },
projectId: '',
user: initiator,
sails.helpers.utils.sendWebhooks.with({
event: 'userCreate',
data: {
item: user,
},
user: inputs.actorUser,
});
return user;