Fix opening media editor when uploading multiple single files after another
authorMatthias Schmidt <gravatronics@live.com>
Tue, 18 Sep 2018 16:08:37 +0000 (18:08 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Tue, 18 Sep 2018 16:08:37 +0000 (18:08 +0200)
See #2606

wcfsetup/install/files/js/WoltLabSuite/Core/Controller/Media/List.js
wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Base.js
wcfsetup/install/files/js/WoltLabSuite/Core/Upload.js

index 7b4757ec7750ccf956dbba509fa8b7c605d10ab8..c9cb35612373fb57c1d1c776669b4800235dbced 100644 (file)
@@ -130,7 +130,7 @@ define([
                 * @since       3.2
                 */
                _openEditorAfterUpload: function(data) {
-                       if (data.upload === _upload && !data.isMultiFileUpload) {
+                       if (data.upload === _upload && !data.isMultiFileUpload && !_upload.hasPendingUploads()) {
                                var keys = Object.keys(data.media);
                                
                                if (keys.length) {
index e3e4a8c0c5feae7927e857a2a36b9612ad3c7898..115eba48742a3971766451230a8b560f176e26bc 100644 (file)
@@ -337,7 +337,7 @@ define(
                 * @since       3.2
                 */
                _openEditorAfterUpload: function(data) {
-                       if (data.upload === this._upload && !data.isMultiFileUpload) {
+                       if (data.upload === this._upload && !data.isMultiFileUpload && !this._upload.hasPendingUploads()) {
                                var keys = Object.keys(data.media);
                                
                                if (keys.length) {
index 697ccd5d6ac207f21bdeed84a9a19269d092b4e5..b9cff77eff21fc2556ff99949350db938b26a42b 100644 (file)
@@ -375,6 +375,26 @@ define(['AjaxRequest', 'Core', 'Dom/ChangeListener', 'Language', 'Dom/Util', 'Do
                        return uploadId;
                },
                
+               /**
+                * Returns true if there are any pending uploads handled by this
+                * upload manager.
+                * 
+                * @return      {boolean}
+                * @since       3.2
+                */
+               hasPendingUploads: function() {
+                       for (var uploadId in this._fileElements) {
+                               for (var i in this._fileElements[uploadId]) {
+                                       var progress = elByTag('PROGRESS', this._fileElements[uploadId][i]);
+                                       if (progress.length === 1) {
+                                               return true;
+                                       }
+                               }
+                       }
+                       
+                       return false;
+               },
+               
                /**
                 * Uploads the given file blob.
                 *