From d52affe65893f17bab59bb43aa9f5afbb54993d3 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Mon, 25 May 2020 17:54:51 +0300 Subject: Move In Progress ostrio-files changes to separate branch, and revert ostrio-files changes, so that: - Export to CSV/TSV with custom fields works - Attachments are not exported to disk - It is possible to build arm64/s390x versions again. Thanks to xet7 ! Related #3110 --- models/cards.js | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'models/cards.js') diff --git a/models/cards.js b/models/cards.js index 757772f3..6d5e23cc 100644 --- a/models/cards.js +++ b/models/cards.js @@ -412,14 +412,10 @@ Cards.helpers({ const _id = Cards.insert(this); // Copy attachments - oldCard.attachments().forEach((file) => { - Meteor.call('cloneAttachment', file, - { - meta: { - cardId: _id - } - } - ); + oldCard.attachments().forEach(att => { + att.cardId = _id; + delete att._id; + return Attachments.insert(att); }); // copy checklists @@ -522,15 +518,14 @@ Cards.helpers({ attachments() { if (this.isLinkedCard()) { return Attachments.find( - { 'meta.cardId': this.linkedId }, + { cardId: this.linkedId }, { sort: { uploadedAt: -1 } }, ); } else { - let ret = Attachments.find( - { 'meta.cardId': this._id }, + return Attachments.find( + { cardId: this._id }, { sort: { uploadedAt: -1 } }, ); - return ret; } }, @@ -539,7 +534,7 @@ Cards.helpers({ const cover = Attachments.findOne(this.coverId); // if we return a cover before it is fully stored, we will get errors when we try to display it // todo XXX we could return a default "upload pending" image in the meantime? - return cover && cover.link(); + return cover && cover.url() && cover; }, checklists() { -- cgit v1.2.3-1-g7c22