From 43135ffc8d8b29a42f27e53ed58b2a6cf9e1b644 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Sun, 3 Jul 2022 22:28:28 +0200 Subject: [PATCH] Copy many cards now also copies attachments --- client/components/cards/cardDetails.js | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 57a45ff01..6adc4b893 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -1089,20 +1089,9 @@ Template.convertChecklistItemToCardPopup.events({ const title = textarea.val().trim(); if (title) { - const oldTitle = card.title; - const titleList = JSON.parse(title); - for (let i = 0; i < titleList.length; i++) { - const obj = titleList[i]; - card.title = obj.title; - card.description = obj.description; - card.coverId = ''; - - // insert new card to the top of new list - const maxOrder = card.getMaxSort(listId, swimlaneId); - card.sort = maxOrder + 1; - - const newCardId = card.copy(boardId, swimlaneId, listId); + for (const obj of titleList) { + const newCardId = Meteor.call('copyCard', card._id, boardId, swimlaneId, listId, false, {title: obj.title, description: obj.description}); // In case the filter is active we need to add the newly inserted card in // the list of exceptions -- cards that are not filtered. Otherwise the @@ -1110,9 +1099,6 @@ Template.convertChecklistItemToCardPopup.events({ // See https://github.com/wekan/wekan/issues/80 Filter.addException(newCardId); } - - // restore the old card title, otherwise the card title would change in the current view (only temporary) - card.title = oldTitle; } } }).register('copyChecklistToManyCardsPopup');