diff --git a/client/components/cards/attachments.jade b/client/components/cards/attachments.jade index ef8740181..74a22f38d 100644 --- a/client/components/cards/attachments.jade +++ b/client/components/cards/attachments.jade @@ -20,7 +20,7 @@ template(name="attachmentsGalery") each attachments .attachment-item a.attachment-thumbnail.swipebox(href="{{link}}" title="{{name}}") - if isUploaded + if link if isImage img.attachment-thumbnail-img(src="{{link}}") else if($eq extension 'mp3') @@ -38,7 +38,7 @@ template(name="attachmentsGalery") else span.attachment-thumbnail-ext= extension else - span.attachment-thumbnail-ext= extension + +spinner p.attachment-details = name span.file-size ({{fileSize size}} KB) diff --git a/client/components/cards/minicard.jade b/client/components/cards/minicard.jade index 4ffcfb485..fbec72194 100644 --- a/client/components/cards/minicard.jade +++ b/client/components/cards/minicard.jade @@ -127,10 +127,10 @@ template(name="minicard") span.badge-icon.fa.fa-check(class="{{#if pokerState}}text-green{{/if}}") if expiredPoker span.badge-text {{ getPokerEstimation }} - if attachments.count + if attachments.length .badge span.badge-icon.fa.fa-paperclip - span.badge-text= attachments.count + span.badge-text= attachments.length if checklists.count .badge(class="{{#if checklistFinished}}is-finished{{/if}}") span.badge-icon.fa.fa-check-square-o diff --git a/models/attachments.js b/models/attachments.js index fe15b3153..6d2e95f0e 100644 --- a/models/attachments.js +++ b/models/attachments.js @@ -83,9 +83,8 @@ if (Meteor.isServer) { }); Meteor.startup(() => { - Attachments.collection._ensureIndex({ cardId: 1 }); + Attachments.collection._ensureIndex({ 'meta.cardId': 1 }); const storagePath = Attachments.storagePath(); - console.log("Meteor.startup check storagePath: ", storagePath); if (!fs.existsSync(storagePath)) { console.log("create storagePath because it doesn't exist: " + storagePath); fs.mkdirSync(storagePath, { recursive: true }); diff --git a/server/migrations.js b/server/migrations.js index 3673ac198..fd61e47cd 100644 --- a/server/migrations.js +++ b/server/migrations.js @@ -1276,3 +1276,7 @@ Migrations.add('migrate-avatars-collectionFS-to-ostrioFiles', () => { readStream.pipe(writeStream); }); }); + +Migrations.add('migrate-attachment-drop-index-cardId', () => { + Attachments.collection._dropIndex({'cardId': 1}); +}); diff --git a/server/publications/cards.js b/server/publications/cards.js index 456da3b67..ac20961f2 100644 --- a/server/publications/cards.js +++ b/server/publications/cards.js @@ -774,7 +774,7 @@ function findCards(sessionId, query) { Users.find({ _id: { $in: users } }, { fields: Users.safeFields }), Checklists.find({ cardId: { $in: cards.map(c => c._id) } }), ChecklistItems.find({ cardId: { $in: cards.map(c => c._id) } }), - Attachments.find({ cardId: { $in: cards.map(c => c._id) } }), + Attachments.find({ 'meta.cardId': { $in: cards.map(c => c._id) } }).cursor, CardComments.find({ cardId: { $in: cards.map(c => c._id) } }), SessionData.find({ userId, sessionId }), ];