From 13fecfae27d535e25c9bbd4c73fd0ceceaa1446e Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Sun, 26 Feb 2023 20:07:32 +0100 Subject: [PATCH] Copy Checklist only copied the checklist items at the first time, now always --- models/checklists.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/models/checklists.js b/models/checklists.js index 38fe15e13..5835d1829 100644 --- a/models/checklists.js +++ b/models/checklists.js @@ -66,11 +66,11 @@ Checklists.attachSchema( Checklists.helpers({ copy(newCardId) { - const oldChecklistId = this._id; - this._id = null; - this.cardId = newCardId; - const newChecklistId = Checklists.insert(this); - ChecklistItems.find({ checklistId: oldChecklistId }).forEach(function( + let copyObj = Object.assign({}, this); + delete copyObj._id; + copyObj.cardId = newCardId; + const newChecklistId = Checklists.insert(copyObj); + ChecklistItems.find({ checklistId: this._id }).forEach(function( item, ) { item._id = null;