diff options
author | Andrés Manelli <andresmanelli@gmail.com> | 2019-02-27 21:07:13 +0100 |
---|---|---|
committer | Andrés Manelli <andresmanelli@gmail.com> | 2019-02-27 21:50:08 +0100 |
commit | abb71083215462d91b084c4de13af0b130638e4d (patch) | |
tree | 342175f13857f4b3d4af06606c7b1c831ecca11b /models | |
parent | da21a2a410c9b905de89d66236748e0c8f5357ea (diff) | |
download | wekan-abb71083215462d91b084c4de13af0b130638e4d.tar.gz wekan-abb71083215462d91b084c4de13af0b130638e4d.tar.bz2 wekan-abb71083215462d91b084c4de13af0b130638e4d.zip |
Copy template attachments
Diffstat (limited to 'models')
-rw-r--r-- | models/cards.js | 9 |
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 |