mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 05:09:43 +02:00
feat: Add notification when user is added to card
This commit is contained in:
parent
f43785c3d0
commit
f6568ce41b
14 changed files with 169 additions and 39 deletions
|
@ -37,15 +37,12 @@ module.exports = {
|
|||
async fn(inputs) {
|
||||
const { values } = inputs;
|
||||
|
||||
if (values.user) {
|
||||
values.userId = values.user.id;
|
||||
}
|
||||
|
||||
let cardMembership;
|
||||
try {
|
||||
cardMembership = await CardMembership.qm.createOne({
|
||||
...values,
|
||||
cardId: values.card.id,
|
||||
userId: values.user.id,
|
||||
});
|
||||
} catch (error) {
|
||||
if (error.code === 'E_UNIQUE') {
|
||||
|
@ -69,6 +66,7 @@ module.exports = {
|
|||
buildData: () => ({
|
||||
item: cardMembership,
|
||||
included: {
|
||||
users: [values.user],
|
||||
projects: [inputs.project],
|
||||
boards: [inputs.board],
|
||||
lists: [inputs.list],
|
||||
|
@ -107,6 +105,20 @@ module.exports = {
|
|||
// TODO: send webhooks
|
||||
}
|
||||
|
||||
await sails.helpers.actions.createOne.with({
|
||||
values: {
|
||||
type: Action.Types.ADD_MEMBER_TO_CARD,
|
||||
data: {
|
||||
user: _.pick(values.user, ['id', 'name']),
|
||||
},
|
||||
user: inputs.actorUser,
|
||||
card: values.card,
|
||||
},
|
||||
project: inputs.project,
|
||||
board: inputs.board,
|
||||
list: inputs.list,
|
||||
});
|
||||
|
||||
return cardMembership;
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue