Ref: Attachment upload handlers

This commit is contained in:
David Arnold 2020-09-13 22:17:58 -05:00 committed by Denis Perov
parent 9c3043d40a
commit 55acce9f0c
3 changed files with 41 additions and 88 deletions

View file

@ -164,16 +164,7 @@ Utils = {
},
MAX_IMAGE_PIXEL: Meteor.settings.public.MAX_IMAGE_PIXEL,
COMPRESS_RATIO: Meteor.settings.public.IMAGE_COMPRESS_RATIO,
processUploadedAttachment(card, fileObj, callback) {
const next = attachment => {
if (typeof callback === 'function') {
callback(attachment);
}
};
if (!card) {
return next();
}
const file = new FS.File(fileObj);
addCommonMetaToAttachment(card, file) {
if (card.isLinkedCard()) {
file.boardId = Cards.findOne(card.linkedId).boardId;
file.cardId = card.linkedId;
@ -185,9 +176,8 @@ Utils = {
}
file.userId = Meteor.userId();
if (file.original) {
file.original.name = fileObj.name;
file.original.name = file.name;
}
return next(Attachments.insert(file));
},
shrinkImage(options) {
// shrink image to certain size