mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 13:19:44 +02:00
feat: Move webhooks configuration from environment variable to UI
This commit is contained in:
parent
f0680831c2
commit
b22dba0d11
128 changed files with 2077 additions and 206 deletions
|
@ -84,8 +84,11 @@ module.exports = {
|
|||
inputs.request,
|
||||
);
|
||||
|
||||
const webhooks = await Webhook.qm.getAll();
|
||||
|
||||
sails.helpers.utils.sendWebhooks.with({
|
||||
event: 'cardCreate',
|
||||
webhooks,
|
||||
event: Webhook.Events.CARD_CREATE,
|
||||
buildData: () => ({
|
||||
item: card,
|
||||
included: {
|
||||
|
@ -120,6 +123,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
await sails.helpers.actions.createOne.with({
|
||||
webhooks,
|
||||
values: {
|
||||
card,
|
||||
type: Action.Types.CREATE_CARD,
|
||||
|
|
|
@ -45,8 +45,11 @@ module.exports = {
|
|||
inputs.request,
|
||||
);
|
||||
|
||||
const webhooks = await Webhook.qm.getAll();
|
||||
|
||||
sails.helpers.utils.sendWebhooks.with({
|
||||
event: 'cardDelete',
|
||||
webhooks,
|
||||
event: Webhook.Events.CARD_DELETE,
|
||||
buildData: () => ({
|
||||
item: card,
|
||||
included: {
|
||||
|
|
|
@ -228,8 +228,11 @@ module.exports = {
|
|||
inputs.request,
|
||||
);
|
||||
|
||||
const webhooks = await Webhook.qm.getAll();
|
||||
|
||||
sails.helpers.utils.sendWebhooks.with({
|
||||
event: 'cardCreate',
|
||||
webhooks,
|
||||
event: Webhook.Events.CARD_CREATE,
|
||||
buildData: () => ({
|
||||
item: card,
|
||||
included: {
|
||||
|
@ -272,6 +275,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
await sails.helpers.actions.createOne.with({
|
||||
webhooks,
|
||||
values: {
|
||||
card,
|
||||
type: Action.Types.CREATE_CARD, // TODO: introduce separate type?
|
||||
|
|
|
@ -31,6 +31,8 @@ module.exports = {
|
|||
},
|
||||
);
|
||||
|
||||
const webhooks = await Webhook.qm.getAll();
|
||||
|
||||
notifications.forEach((notification) => {
|
||||
sails.sockets.broadcast(
|
||||
`user:${notification.userId}`,
|
||||
|
@ -43,7 +45,8 @@ module.exports = {
|
|||
|
||||
// TODO: with prevData?
|
||||
sails.helpers.utils.sendWebhooks.with({
|
||||
event: 'notificationUpdate',
|
||||
webhooks,
|
||||
event: Webhook.Events.NOTIFICATION_UPDATE,
|
||||
buildData: () => ({
|
||||
item: notification,
|
||||
}),
|
||||
|
|
|
@ -31,6 +31,9 @@ module.exports = {
|
|||
type: 'ref',
|
||||
required: true,
|
||||
},
|
||||
webhooks: {
|
||||
type: 'ref',
|
||||
},
|
||||
request: {
|
||||
type: 'ref',
|
||||
},
|
||||
|
@ -104,6 +107,8 @@ module.exports = {
|
|||
if (_.isEmpty(values)) {
|
||||
card = inputs.record;
|
||||
} else {
|
||||
const { webhooks = await Webhook.qm.getAll() } = inputs;
|
||||
|
||||
if (!_.isNil(values.position)) {
|
||||
const cards = await Card.qm.getByListId(list.id, {
|
||||
exceptIdOrIds: inputs.record.id,
|
||||
|
@ -402,6 +407,7 @@ module.exports = {
|
|||
|
||||
const { id } = await sails.helpers.labels.createOne.with({
|
||||
project,
|
||||
webhooks,
|
||||
values: {
|
||||
..._.omit(label, ['id', 'boardId', 'createdAt', 'updatedAt']),
|
||||
board,
|
||||
|
@ -459,6 +465,7 @@ module.exports = {
|
|||
|
||||
if (values.list) {
|
||||
await sails.helpers.actions.createOne.with({
|
||||
webhooks,
|
||||
values: {
|
||||
card,
|
||||
type: Action.Types.MOVE_CARD,
|
||||
|
@ -477,7 +484,8 @@ module.exports = {
|
|||
}
|
||||
|
||||
sails.helpers.utils.sendWebhooks.with({
|
||||
event: 'cardUpdate',
|
||||
webhooks,
|
||||
event: Webhook.Events.CARD_UPDATE,
|
||||
buildData: () => ({
|
||||
item: card,
|
||||
included: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue