Copy Checklist only copied the checklist items at the first time, now always

This commit is contained in:
Martin Filser 2023-02-26 20:07:32 +01:00
parent b7819cad69
commit 13fecfae27

View file

@ -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;