1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-18 20:59:44 +02:00

Remove members and labels when transfer card to another board

This commit is contained in:
Maksim Eltyshev 2020-05-05 03:33:29 +05:00
parent b1d187476d
commit 328aa63f6e
2 changed files with 33 additions and 2 deletions

View file

@ -80,12 +80,32 @@ module.exports = {
let card;
if (!_.isEmpty(values)) {
// FIXME: hack
if (inputs.toList && inputs.toList.boardId !== inputs.list.boardId) {
await CardSubscription.destroy({
cardId: inputs.record.id,
});
await CardMembership.destroy({
cardId: inputs.record.id,
});
await CardLabel.destroy({
cardId: inputs.record.id,
});
}
card = await Card.updateOne(inputs.record.id).set(values);
if (!card) {
return exits.success(card);
}
// FIXME: hack
if (inputs.toList && inputs.toList.boardId !== inputs.list.boardId) {
card.isSubscribed = false;
}
sails.sockets.broadcast(
`board:${card.boardId}`,
'cardUpdate',