1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-21 14:19:44 +02:00

feat: Google Chat notifications (#867)

This commit is contained in:
Maël Gangloff 2024-09-04 15:33:43 +02:00 committed by GitHub
parent 9699fbe76a
commit 8fd0f682d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 65 additions and 9 deletions

View file

@ -14,7 +14,7 @@ const valuesValidator = (value) => {
return true;
};
const buildAndSendSlackMessage = async (card, action, actorUser) => {
const buildAndSendMessage = async (card, action, actorUser, send) => {
const cardLink = `<${sails.config.custom.baseUrl}/cards/${card.id}|${card.name}>`;
let markdown;
@ -35,7 +35,7 @@ const buildAndSendSlackMessage = async (card, action, actorUser) => {
return;
}
await sails.helpers.utils.sendSlackMessage(markdown);
await send(markdown);
};
module.exports = {
@ -94,10 +94,6 @@ module.exports = {
user: values.user,
});
if (sails.config.custom.slackBotToken) {
buildAndSendSlackMessage(values.card, action, values.user);
}
const subscriptionUserIds = await sails.helpers.cards.getSubscriptionUserIds(
action.cardId,
action.userId,
@ -119,6 +115,18 @@ module.exports = {
),
);
if (sails.config.custom.slackBotToken) {
buildAndSendMessage(values.card, action, values.user, sails.helpers.utils.sendSlackMessage);
}
if (sails.config.custom.googleChatWebhookUrl) {
buildAndSendMessage(
values.card,
action,
values.user,
sails.helpers.utils.sendGoogleChatMessage,
);
}
return action;
},
};