jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/405588 )

Change subject: mediawiki.special.upload: Use mediawiki.api.parse
......................................................................


mediawiki.special.upload: Use mediawiki.api.parse

This also adds the parameter contentmodel=wikitext to the API request.
This ensures that the text is always parsed as wikitext, even with a
title with a different content model like 'MediaWiki:Common.js'.

Change-Id: I29f0c76c3354a8c97b8296224e14341f71726c2f
---
M resources/Resources.php
M resources/src/mediawiki.special/mediawiki.special.upload.js
2 files changed, 3 insertions(+), 5 deletions(-)

Approvals:
  Bartosz Dziewoński: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/resources/Resources.php b/resources/Resources.php
index 109ab7d..0e9ab18 100644
--- a/resources/Resources.php
+++ b/resources/Resources.php
@@ -2208,6 +2208,7 @@
                        'jquery.spinner',
                        'mediawiki.jqueryMsg',
                        'mediawiki.api',
+                       'mediawiki.api.parse',
                        'mediawiki.libs.jpegmeta',
                        'mediawiki.Title',
                        'mediawiki.util',
diff --git a/resources/src/mediawiki.special/mediawiki.special.upload.js 
b/resources/src/mediawiki.special/mediawiki.special.upload.js
index 9bf6255..0c3eb21 100644
--- a/resources/src/mediawiki.special/mediawiki.special.upload.js
+++ b/resources/src/mediawiki.special/mediawiki.special.upload.js
@@ -134,10 +134,7 @@
 
                        $spinner = $.createSpinner().insertAfter( $element );
 
-                       ( new mw.Api() ).get( {
-                               formatversion: 2,
-                               action: 'parse',
-                               text: '{{' + template + '}}',
+                       ( new mw.Api() ).parse( '{{' + template + '}}', {
                                title: $( '#wpDestFile' ).val() || 
'File:Sample.jpg',
                                prop: 'text',
                                pst: true,
@@ -150,7 +147,7 @@
                },
 
                processResult: function ( result, template, $previewContainer ) 
{
-                       this.responseCache[ template ] = result.parse.text;
+                       this.responseCache[ template ] = result;
                        this.showPreview( this.responseCache[ template ], 
$previewContainer );
                },
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I29f0c76c3354a8c97b8296224e14341f71726c2f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Fomafix <foma...@googlemail.com>
Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to