mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Fix creation of card links
Without this fix, orphaned card links are created and therefore this leads to problems as described in https://github.com/wekan/wekan/issues/2785.
This commit is contained in:
parent
c7d4a90d5c
commit
2691f033cb
2 changed files with 16 additions and 4 deletions
|
|
@ -658,10 +658,7 @@ BlazeComponent.extendComponent({
|
||||||
_id = element.copy(this.boardId, this.swimlaneId, this.listId);
|
_id = element.copy(this.boardId, this.swimlaneId, this.listId);
|
||||||
// 1.B Linked card
|
// 1.B Linked card
|
||||||
} else {
|
} else {
|
||||||
delete element._id;
|
_id = element.link(this.boardId, this.swimlaneId, this.listId);
|
||||||
element.type = 'cardType-linkedCard';
|
|
||||||
element.linkedId = element.linkedId || element._id;
|
|
||||||
_id = Cards.insert(element);
|
|
||||||
}
|
}
|
||||||
Filter.addException(_id);
|
Filter.addException(_id);
|
||||||
// List insertion
|
// List insertion
|
||||||
|
|
|
||||||
|
|
@ -428,6 +428,21 @@ Cards.helpers({
|
||||||
return _id;
|
return _id;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
link(boardId, swimlaneId, listId) {
|
||||||
|
// TODO is there a better method to create a deepcopy?
|
||||||
|
linkCard = JSON.parse(JSON.stringify(this));
|
||||||
|
// TODO is this how it is meant to be?
|
||||||
|
linkCard.linkedId = linkCard.linkedId || linkCard._id;
|
||||||
|
linkCard.boardId = boardId;
|
||||||
|
linkCard.swimlaneId = swimlaneId;
|
||||||
|
linkCard.listId = listId;
|
||||||
|
linkCard.type = 'cardType-linkedCard';
|
||||||
|
delete linkCard._id;
|
||||||
|
// TODO shall we copy the labels for a linked card?!
|
||||||
|
delete linkCard.labelIds;
|
||||||
|
return Cards.insert(linkCard);
|
||||||
|
},
|
||||||
|
|
||||||
list() {
|
list() {
|
||||||
return Lists.findOne(this.listId);
|
return Lists.findOne(this.listId);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue