summaryrefslogtreecommitdiffstats
path: root/models/cards.js
diff options
context:
space:
mode:
authorRomulus Urakagi Tsai <urakagi@gmail.com>2019-11-20 10:40:09 +0000
committerRomulus Urakagi Tsai <urakagi@gmail.com>2019-11-20 10:40:09 +0000
commit4dcdec0084414e7dde9e630add01ecd2865bd941 (patch)
treeba145af20e31e57c48e25948d14f31469e8b2690 /models/cards.js
parent05c53ca01d71a01a608c9ae345475abd67c9939b (diff)
downloadwekan-4dcdec0084414e7dde9e630add01ecd2865bd941.tar.gz
wekan-4dcdec0084414e7dde9e630add01ecd2865bd941.tar.bz2
wekan-4dcdec0084414e7dde9e630add01ecd2865bd941.zip
Attachment upload from card done, need to fix download link
Diffstat (limited to 'models/cards.js')
-rw-r--r--models/cards.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/models/cards.js b/models/cards.js
index 3944b09f..4c3e2c99 100644
--- a/models/cards.js
+++ b/models/cards.js
@@ -366,7 +366,7 @@ Cards.helpers({
// Copy attachments
oldCard.attachments().forEach(att => {
- att.cardId = _id;
+ att.meta.cardId = _id;
delete att._id;
return Attachments.insert(att);
});
@@ -456,14 +456,16 @@ Cards.helpers({
attachments() {
if (this.isLinkedCard()) {
return Attachments.find(
- { cardId: this.linkedId },
+ { 'meta.cardId': this.linkedId },
{ sort: { uploadedAt: -1 } },
);
} else {
- return Attachments.find(
- { cardId: this._id },
+ const ret = Attachments.find(
+ { 'meta.cardId': this._id },
{ sort: { uploadedAt: -1 } },
);
+ if (ret.first()) console.log('link', Attachments.link(ret.first()));
+ return ret;
}
},
@@ -471,7 +473,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.url() && cover;
+ return cover && cover.link();
},
checklists() {