summaryrefslogtreecommitdiffstats
path: root/client/lib
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2020-05-24 03:13:53 +0300
committerLauri Ojansivu <x@xet7.org>2020-05-24 03:13:53 +0300
commit055b5285328f495203a7e225fdecd04bcf5c8b32 (patch)
tree361621362801c5409a08d60f45ebedb9f1cf9c02 /client/lib
parentfda392e662a842aa7e686ce13870c8adb35c35ab (diff)
parent921460db4031134db863e32101c0ad60a17416b5 (diff)
downloadwekan-055b5285328f495203a7e225fdecd04bcf5c8b32.tar.gz
wekan-055b5285328f495203a7e225fdecd04bcf5c8b32.tar.bz2
wekan-055b5285328f495203a7e225fdecd04bcf5c8b32.zip
Merge branch 'lib-change' of https://github.com/PDIS/wekan into
PDIS-lib-change
Diffstat (limited to 'client/lib')
-rw-r--r--client/lib/popup.js2
-rw-r--r--client/lib/utils.js44
2 files changed, 27 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..e72f177e 100644
--- a/client/lib/utils.js
+++ b/client/lib/utils.js
@@ -61,30 +61,38 @@ 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 = {
+ uploading: true
+ };
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