summaryrefslogtreecommitdiffstats
path: root/client/lib
diff options
context:
space:
mode:
Diffstat (limited to 'client/lib')
-rw-r--r--client/lib/popup.js2
-rw-r--r--client/lib/utils.js42
2 files changed, 25 insertions, 19 deletions
diff --git a/client/lib/popup.js b/client/lib/popup.js
index 8095fbd2..cae22659 100644
--- a/client/lib/popup.js
+++ b/client/lib/popup.js
@@ -49,7 +49,7 @@ window.Popup = new (class {
// has one. This allows us to position a sub-popup exactly at the same
// position than its parent.
let openerElement;
- if (clickFromPopup(evt)) {
+ if (clickFromPopup(evt) && self._getTopStack()) {
openerElement = self._getTopStack().openerElement;
} else {
self._stack = [];
diff --git a/client/lib/utils.js b/client/lib/utils.js
index c921fddc..d712cc73 100644
--- a/client/lib/utils.js
+++ b/client/lib/utils.js
@@ -61,30 +61,36 @@ 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);
- }
- };
+ processUploadedAttachment(card, fileObj, callbacks) {
if (!card) {
- return next();
+ return onUploaded();
}
- 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) {
- file.original.name = fileObj.name;
+ settings.meta.userId = Meteor.userId();
+ if (typeof callbacks === 'function') {
+ settings.onEnd = callbacks;
+ } else {
+ for (const key in callbacks) {
+ if (key.substring(0, 2) === 'on') {
+ settings[key] = callbacks[key];
+ }
+ }
}
- return next(Attachments.insert(file));
+ Attachments.insert(settings);
},
shrinkImage(options) {
// shrink image to certain size