mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Ref: Attachment upload handlers
This commit is contained in:
parent
9c3043d40a
commit
55acce9f0c
3 changed files with 41 additions and 88 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue