MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/170389

Change subject: Move extra-file handling out of UWU
......................................................................

Move extra-file handling out of UWU

Should be a global process, really.

Change-Id: I17fdfb587a81e8dd366ee6fbc16a5c43debb38ae
---
M resources/mw.UploadWizard.js
M resources/mw.UploadWizardUpload.js
2 files changed, 11 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/89/170389/1

diff --git a/resources/mw.UploadWizard.js b/resources/mw.UploadWizard.js
index be60289..23d330f 100644
--- a/resources/mw.UploadWizard.js
+++ b/resources/mw.UploadWizard.js
@@ -431,6 +431,15 @@
                                        wizard.setUploadFilled( upload );
                                } )
 
+                               .on( 'extra-files', function ( files, 
generatePreviews ) {
+                                       $.each( files, function ( i, file ) {
+                                               // NOTE: By running newUpload 
we will end up calling checkfile() again.
+                                               wizard.newUpload( file, 
generatePreviews );
+                                       } );
+
+                                       wizard.updateFileCounts();
+                               } )
+
                                .on( 'error', function ( code, message ) {
                                        uw.eventFlowLogger.logError( 'file', { 
code: code, message: message } );
                                } );
diff --git a/resources/mw.UploadWizardUpload.js 
b/resources/mw.UploadWizardUpload.js
index 5215408..7ce1fdd 100644
--- a/resources/mw.UploadWizardUpload.js
+++ b/resources/mw.UploadWizardUpload.js
@@ -545,13 +545,8 @@
 
                                        // Now that first file has been 
prepared, process remaining files
                                        // in case of a multi-file upload.
-                                       files = files.slice( 1 );
-                                       if ( files.length > 0 ) {
-                                               $.each( files, function ( i, 
file ) {
-                                                       // NOTE: By running 
newUpload we will end up calling checkfile() again.
-                                                       
upload.wizard.newUpload( file, generatePreviews );
-                                               } );
-                                               this.wizard.updateFileCounts();
+                                       if ( files.length > 1 ) {
+                                               this.emit( 'extra-files', 
files.slice( 1 ), generatePreviews );
                                        }
                                } else {
                                        this.filename = filename;

-- 
To view, visit https://gerrit.wikimedia.org/r/170389
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I17fdfb587a81e8dd366ee6fbc16a5c43debb38ae
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to