瀏覽代碼

Copy many cards now also copies attachments

Martin Filser 3 年之前
父節點
當前提交
43135ffc8d
共有 1 個文件被更改,包括 2 次插入16 次删除
  1. 2 16
      client/components/cards/cardDetails.js

+ 2 - 16
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');