summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/cards.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/models/cards.js b/models/cards.js
index 9dda6dae..cf64cd9b 100644
--- a/models/cards.js
+++ b/models/cards.js
@@ -287,6 +287,8 @@ Cards.helpers({
}), '_id');
const oldId = this._id;
+ const oldCard = Cards.findOne(oldId);
+
delete this._id;
delete this.labelIds;
this.labelIds= newCardLabels;
@@ -295,6 +297,13 @@ Cards.helpers({
this.listId = listId;
const _id = Cards.insert(this);
+ // Copy attachments
+ oldCard.attachments().forEach((att) => {
+ att.cardId = _id;
+ delete att._id;
+ return Attachments.insert(att);
+ });
+
// copy checklists
Checklists.find({cardId: oldId}).forEach((ch) => {
// REMOVE verify copy with arguments