diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/components/cards/attachments.js | 24 | ||||
-rw-r--r-- | client/lib/utils.js | 28 |
2 files changed, 33 insertions, 19 deletions
diff --git a/client/components/cards/attachments.js b/client/components/cards/attachments.js index e4439155..604dc078 100644 --- a/client/components/cards/attachments.js +++ b/client/components/cards/attachments.js @@ -149,20 +149,28 @@ Template.previewClipboardImagePopup.events({ if (results && results.file) { window.oPasted = pastedResults; const card = this; - const file = new FS.File(results.file); + const settings = { + file: results.file, + streams: 'dynamic', + chunkSize: 'dynamic' + }; if (!results.name) { // if no filename, it's from clipboard. then we give it a name, with ext name from MIME type + // FIXME: Check this behavior if (typeof results.file.type === 'string') { - file.name(results.file.type.replace('image/', 'clipboard.')); + settings.fileName = new Date().getTime() + results.file.type.replace('.+/', ''); } } - file.updatedAt(new Date()); - file.boardId = card.boardId; - file.cardId = card._id; - file.userId = Meteor.userId(); - const attachment = Attachments.insert(file); + settings.meta = {}; + settings.meta.updatedAt = new Date().getTime(); + settings.meta.boardId = card.boardId; + settings.meta.cardId = card._id; + settings.meta.userId = Meteor.userId(); + console.log('settings', settings); + const attachment = Attachments.insert(settings, false); - if (attachment && attachment._id && attachment.isImage()) { + // TODO: Check image cover behavior + if (attachment && attachment._id && attachment.isImage) { card.setCover(attachment._id); } diff --git a/client/lib/utils.js b/client/lib/utils.js index cc3526c0..2694396f 100644 --- a/client/lib/utils.js +++ b/client/lib/utils.js @@ -34,21 +34,27 @@ Utils = { if (!card) { return next(); } - const file = new FS.File(fileObj); + let settings = { + file: fileObj, + streams: 'dynamic', + chunkSize: 'dynamic' + }; + settings.meta = {}; if (card.isLinkedCard()) { - file.boardId = Cards.findOne(card.linkedId).boardId; - file.cardId = card.linkedId; + settings.meta.boardId = Cards.findOne(card.linkedId).boardId; + settings.meta.cardId = card.linkedId; } else { - file.boardId = card.boardId; - file.swimlaneId = card.swimlaneId; - file.listId = card.listId; - file.cardId = card._id; + settings.meta.boardId = card.boardId; + settings.meta.swimlaneId = card.swimlaneId; + settings.meta.listId = card.listId; + settings.meta.cardId = card._id; } - file.userId = Meteor.userId(); - if (file.original) { + settings.meta.userId = Meteor.userId(); + // FIXME: What is this? +/* if (file.original) { file.original.name = fileObj.name; - } - return next(Attachments.insert(file)); + }*/ + return next(Attachments.insert(settings, false)); }, shrinkImage(options) { // shrink image to certain size |