summaryrefslogtreecommitdiffstats
path: root/models/cards.js
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2020-05-25 17:54:51 +0300
committerLauri Ojansivu <x@xet7.org>2020-05-25 17:54:51 +0300
commitd52affe65893f17bab59bb43aa9f5afbb54993d3 (patch)
tree82b88066d4fb8efb6610ed77177d3747d34f0480 /models/cards.js
parent23dcd084a49de4e6568527d8f97ed25adb04dafd (diff)
downloadwekan-d52affe65893f17bab59bb43aa9f5afbb54993d3.tar.gz
wekan-d52affe65893f17bab59bb43aa9f5afbb54993d3.tar.bz2
wekan-d52affe65893f17bab59bb43aa9f5afbb54993d3.zip
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
Diffstat (limited to 'models/cards.js')
-rw-r--r--models/cards.js21
1 files changed, 8 insertions, 13 deletions
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() {