diff options
Diffstat (limited to 'models')
-rw-r--r-- | models/attachments.js | 6 | ||||
-rw-r--r-- | models/cards.js | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/models/attachments.js b/models/attachments.js index 4537e47c..5dcc75e6 100644 --- a/models/attachments.js +++ b/models/attachments.js @@ -2,9 +2,12 @@ import { FilesCollection } from 'meteor/ostrio:files'; Attachments = new FilesCollection({ storagePath: storagePath(), - debug: true, // FIXME: Remove debug mode + debug: false, // FIXME: Remove debug mode collectionName: 'attachments2', allowClientCode: true, // FIXME: Permissions + onAfterUpload: (fileRef) => { + Attachments.update({_id:fileRef._id}, {$set: {"meta.uploaded": true}}); + } }); if (Meteor.isServer) { @@ -15,6 +18,7 @@ if (Meteor.isServer) { // TODO: Permission related // TODO: Add Activity update // TODO: publish and subscribe + Meteor.publish('attachments', function() { return Attachments.find().cursor; }); diff --git a/models/cards.js b/models/cards.js index 4c3e2c99..86d22c53 100644 --- a/models/cards.js +++ b/models/cards.js @@ -460,11 +460,10 @@ Cards.helpers({ { sort: { uploadedAt: -1 } }, ); } else { - const ret = Attachments.find( + let ret = Attachments.find( { 'meta.cardId': this._id }, { sort: { uploadedAt: -1 } }, ); - if (ret.first()) console.log('link', Attachments.link(ret.first())); return ret; } }, |