From 69c5c7a2e3c37a0b5b7140d667ee2e1d62dae58d Mon Sep 17 00:00:00 2001 From: "David Humphrey (:humph) david.humphrey@senecacollege.ca" Date: Tue, 1 Mar 2016 12:54:27 -0500 Subject: [PATCH] Fix #530 - Figure out why DnD using the Upload Files dialog is broken --- src/utils/DragAndDrop.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/utils/DragAndDrop.js b/src/utils/DragAndDrop.js index 570c4f3817e..da3a794568a 100644 --- a/src/utils/DragAndDrop.js +++ b/src/utils/DragAndDrop.js @@ -70,7 +70,7 @@ define(function (require, exports, module) { return false; } - function _showErrorDialog(errorFiles) { + function _showErrorDialog(errorFiles, callback) { function errorToString(err) { return FileUtils.getFileErrorString(err); } @@ -90,11 +90,15 @@ define(function (require, exports, module) { }); message += ""; - Dialogs.showModalDialog( + var dlg = Dialogs.showModalDialog( DefaultDialogs.DIALOG_ID_ERROR, Strings.ERROR_OPENING_FILE_TITLE, message ); + + if(callback) { + dlg.done(callback); + } } /** @@ -386,10 +390,8 @@ define(function (require, exports, module) { // Check whether we want to import this file at all before we start. var wasRejected = rejectImport(item); if (wasRejected) { - setTimeout(function(){ - errorList.push({path: item.name, error: wasRejected.message}); - deferred.reject(wasRejected); - }, 5); + errorList.push({path: item.name, error: wasRejected.message}); + deferred.reject(wasRejected); return deferred.promise(); } @@ -438,8 +440,9 @@ define(function (require, exports, module) { callback(null, pathList); }) .fail(function() { - _showErrorDialog(errorList); - callback(errorList); + _showErrorDialog(errorList, function() { + callback(errorList); + }); }); }