jenkins-bot has submitted this change and it was merged.

Change subject: Make fileChangedOk a little more sane
......................................................................


Make fileChangedOk a little more sane

It no longer uses this.upload, which is a nice start...

Change-Id: I0cc3754f27f867a618af33bdcefe780d35c1ed89
---
M resources/mw.UploadWizard.js
M resources/mw.UploadWizardUpload.js
M resources/mw.UploadWizardUploadInterface.js
3 files changed, 16 insertions(+), 6 deletions(-)

Approvals:
  Gilles: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/resources/mw.UploadWizard.js b/resources/mw.UploadWizard.js
index b7bb69c..0742bfe 100644
--- a/resources/mw.UploadWizard.js
+++ b/resources/mw.UploadWizard.js
@@ -413,7 +413,7 @@
                                        upload.checkFile(
                                                upload.ui.getFilename(),
                                                files,
-                                               function () { 
upload.ui.fileChangedOk(); },
+                                               function () { 
upload.fileChangedOk(); },
                                                function ( code, info ) { 
upload.ui.fileChangedError( code, info ); }
                                        );
 
diff --git a/resources/mw.UploadWizardUpload.js 
b/resources/mw.UploadWizardUpload.js
index d34f1fc..f486d28 100644
--- a/resources/mw.UploadWizardUpload.js
+++ b/resources/mw.UploadWizardUpload.js
@@ -1144,5 +1144,12 @@
                this.details.attach();
        };
 
+       /**
+        * Notification that the file input has changed and it's fine...set 
info.
+        */
+       UWUP.fileChangedOk = function () {
+               this.ui.fileChangedOk( this.imageinfo, this.file, this.fromURL 
);
+       };
+
        mw.UploadWizardUpload = UploadWizardUpload;
 } )( mediaWiki, jQuery, OO );
diff --git a/resources/mw.UploadWizardUploadInterface.js 
b/resources/mw.UploadWizardUploadInterface.js
index 272f191..91f4d02 100644
--- a/resources/mw.UploadWizardUploadInterface.js
+++ b/resources/mw.UploadWizardUploadInterface.js
@@ -331,20 +331,23 @@
         * Run this when the value of the file input has changed and we know 
it's acceptable -- this
         * will update interface to show as much info as possible, including 
preview.
         * n.b. in older browsers we only will know the filename
+        * @param {Object} imageinfo
+        * @param {File} file
+        * @param {boolean} fromURL
         */
-       UIP.fileChangedOk = function () {
+       UIP.fileChangedOk = function ( imageinfo, file, fromURL ) {
                var ui = this,
                        statusItems = [];
 
                this.updateFilename();
 
                // set the status string - e.g. "256 Kb, 100 x 200"
-               if ( this.upload.imageinfo && this.upload.imageinfo.width && 
this.upload.imageinfo.height ) {
-                       statusItems.push( this.upload.imageinfo.width + 
'\u00d7' + this.upload.imageinfo.height );
+               if ( imageinfo && imageinfo.width && imageinfo.height ) {
+                       statusItems.push( imageinfo.width + '\u00d7' + 
imageinfo.height );
                }
 
-               if ( this.upload.file && !this.upload.fromURL ) {
-                       statusItems.push( mw.units.bytes( this.upload.file.size 
) );
+               if ( file && !fromURL ) {
+                       statusItems.push( mw.units.bytes( file.size ) );
                }
 
                this.clearStatus();

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0cc3754f27f867a618af33bdcefe780d35c1ed89
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <[email protected]>
Gerrit-Reviewer: Gilles <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to