fix cardnumber assignment for moved or copied card

This commit is contained in:
Kai Lehmann 2021-08-03 14:03:05 +02:00
parent e8522c323f
commit 2fd741bf54

View file

@ -577,6 +577,7 @@ Cards.helpers({
delete this._id; delete this._id;
this.boardId = boardId; this.boardId = boardId;
this.cardNumber = Boards.findOne(boardId).getNextCardNumber();
this.swimlaneId = swimlaneId; this.swimlaneId = swimlaneId;
this.listId = listId; this.listId = listId;
const _id = Cards.insert(this); const _id = Cards.insert(this);
@ -1989,8 +1990,12 @@ Cards.mutations({
'_id', '_id',
); );
// assign the new card number from the target board
const newCardNumber = newBoard.getNextCardNumber();
Object.assign(mutatedFields, { Object.assign(mutatedFields, {
labelIds: newCardLabelIds, labelIds: newCardLabelIds,
cardNumber: newCardNumber
}); });
mutatedFields.customFields = this.mapCustomFieldsToBoard(newBoard._id); mutatedFields.customFields = this.mapCustomFieldsToBoard(newBoard._id);