Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attachments fixes after migration to meteor files (image preview, global search) #4405

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions client/components/cards/attachments.jade
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions client/components/cards/minicard.jade
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions models/attachments.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
4 changes: 4 additions & 0 deletions server/migrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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});
});
2 changes: 1 addition & 1 deletion server/publications/cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }),
];
Expand Down