Skip to content

Commit

Permalink
Merge pull request #28882 from owncloud/stable10-fix-filelist-drop-ta…
Browse files Browse the repository at this point in the history
…rget

[stable10]  Fix getting drop target when dragging from file manager
  • Loading branch information
Vincent Petry authored Sep 1, 2017
2 parents 186305d + 5c26782 commit 9983908
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
13 changes: 9 additions & 4 deletions apps/files/js/file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ OC.FileUpload.prototype = {
this.data.headers['Authorization'] =
'Basic ' + btoa(userName + ':' + (password || ''));
}
this.data.headers['requesttoken'] = OC.requestToken;

var chunkFolderPromise;
if ($.support.blobSlice
Expand Down Expand Up @@ -1195,11 +1196,15 @@ OC.Uploader.prototype = _.extend({
fileupload.on('fileuploaddone', function(e, data) {
var upload = self.getUpload(data);
upload.done().then(function() {
// don't hide if there are more files to process
if (!self.isProcessing()) {
self._hideProgressBar();
}
self.trigger('done', e, upload);
// defer because sometimes the current upload is still in pending
// state but frees itself afterwards
_.defer(function() {
// don't hide if there are more files to process
if (!self.isProcessing()) {
self._hideProgressBar();
}
});
}).fail(function(status, response) {
var message = response.message;
self._hideProgressBar();
Expand Down
2 changes: 1 addition & 1 deletion apps/files/js/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -2702,7 +2702,7 @@
return false;
}

var dropTarget = $(e.originalEvent.target);
var dropTarget = $(e.originalEvent.delegatedEvent.target);
// check if dropped inside this container and not another one
if (dropTarget.length
&& !self.$el.is(dropTarget) // dropped on list directly
Expand Down
4 changes: 3 additions & 1 deletion apps/files/tests/js/filelistSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2649,7 +2649,9 @@ describe('OCA.Files.FileList tests', function() {
function dropOn($target, data) {
var eventData = {
originalEvent: {
target: $target
delegatedEvent: {
target: $target
}
}
};
uploader.trigger('drop', eventData, data || {});
Expand Down

0 comments on commit 9983908

Please sign in to comment.