Gerrit Patch Uploader has uploaded a new change for review.

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

Change subject: mediawiki.special.upload.js: Use formatversion=2 for API 
requests
......................................................................

mediawiki.special.upload.js: Use formatversion=2 for API requests

This simplifies the processing of the response.

Change-Id: I2073ec2c017e4d5c5c7f786b45118516feea1aac
---
M resources/src/mediawiki.special/mediawiki.special.upload.js
1 file changed, 7 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/95/283595/1

diff --git a/resources/src/mediawiki.special/mediawiki.special.upload.js 
b/resources/src/mediawiki.special/mediawiki.special.upload.js
index 8c89ed9..e912bd7 100644
--- a/resources/src/mediawiki.special/mediawiki.special.upload.js
+++ b/resources/src/mediawiki.special/mediawiki.special.upload.js
@@ -64,15 +64,15 @@
                        $spinnerDestCheck = $.createSpinner().insertAfter( 
'#wpDestFile' );
 
                        ( new mw.Api() ).get( {
+                               formatversion: 2,
                                action: 'query',
                                titles: ( new mw.Title( this.nameToCheck, 
mw.config.get( 'wgNamespaceIds' ).file ) ).getPrefixedText(),
                                prop: 'imageinfo',
-                               iiprop: 'uploadwarning',
-                               indexpageids: true
+                               iiprop: 'uploadwarning'
                        } ).done( function ( result ) {
                                var resultOut = '';
                                if ( result.query ) {
-                                       resultOut = result.query.pages[ 
result.query.pageids[ 0 ] ].imageinfo[ 0 ];
+                                       resultOut = result.query.pages[ 0 
].imageinfo[ 0 ].html;
                                }
                                $spinnerDestCheck.remove();
                                uploadWarning.processResult( resultOut, 
uploadWarning.nameToCheck );
@@ -80,8 +80,8 @@
                },
 
                processResult: function ( result, fileName ) {
-                       this.setWarning( result.html );
-                       this.responseCache[ fileName ] = result.html;
+                       this.setWarning( result );
+                       this.responseCache[ fileName ] = result;
                },
 
                setWarning: function ( warning ) {
@@ -117,6 +117,7 @@
                        $spinnerLicense = $.createSpinner().insertAfter( 
'#wpLicense' );
 
                        ( new mw.Api() ).get( {
+                               formatversion: 2,
                                action: 'parse',
                                text: '{{' + license + '}}',
                                title: $( '#wpDestFile' ).val() || 
'File:Sample.jpg',
@@ -129,7 +130,7 @@
                },
 
                processResult: function ( result, license ) {
-                       this.responseCache[ license ] = result.parse.text[ '*' 
];
+                       this.responseCache[ license ] = result.parse.text;
                        this.showPreview( this.responseCache[ license ] );
                },
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2073ec2c017e4d5c5c7f786b45118516feea1aac
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Gerrit Patch Uploader <[email protected]>

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

Reply via email to