Bartosz Dziewoński has uploaded a new change for review.

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

Change subject: Avoid double-escaping
......................................................................

Avoid double-escaping

Things you generally don't need to escape include:

* Message parameters in mw.message() and $().msg()
* 'label' and 'title' config options for OOjs UI widgets
* Things you're going to pass to $().text() or $().attr()

Change-Id: Ib787ab5a3a546cbae8fadb5bf31cb356755a95db
---
M resources/jquery/jquery.showThumbCtrl.js
M resources/mw.GroupProgressBar.js
M resources/mw.UploadWizard.js
M resources/mw.UploadWizardDetails.js
M resources/mw.UploadWizardUpload.js
M resources/mw.UploadWizardUploadInterface.js
M resources/mw.units.js
M resources/ui/steps/uw.ui.Tutorial.js
8 files changed, 16 insertions(+), 16 deletions(-)


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

diff --git a/resources/jquery/jquery.showThumbCtrl.js 
b/resources/jquery/jquery.showThumbCtrl.js
index bb4a9ca..3bdb595 100644
--- a/resources/jquery/jquery.showThumbCtrl.js
+++ b/resources/jquery/jquery.showThumbCtrl.js
@@ -5,7 +5,7 @@
        $.fn.showThumbCtrl = function ( msgKey, tooltipMsgKey, callback ) {
                var msg = (msgKey === null) ? '' : mw.message( msgKey 
).escaped();
                return $( '<div class="mwe-upwiz-show-thumb-ctrl ui-corner-all" 
/>' )
-                       .attr( 'title', mw.message( tooltipMsgKey ).escaped() )
+                       .attr( 'title', mw.message( tooltipMsgKey ).text() )
                        .click( function () {
                                $( this )
                                        .addClass( 'disabled' )
diff --git a/resources/mw.GroupProgressBar.js b/resources/mw.GroupProgressBar.js
index 5334eb3..0c9bafc 100644
--- a/resources/mw.GroupProgressBar.js
+++ b/resources/mw.GroupProgressBar.js
@@ -138,9 +138,9 @@
 
                        if ( remainingTime !== null ) {
                                if ( remainingTime === 0 ) {
-                                       timeString = mw.message( 
'mwe-upwiz-finished' ).escaped();
+                                       timeString = mw.message( 
'mwe-upwiz-finished' ).text();
                                } else if ( remainingTime < 1000 ) {
-                                       timeString = mw.message( 
'mwe-upwiz-almost-finished' ).escaped();
+                                       timeString = mw.message( 
'mwe-upwiz-almost-finished' ).text();
                                } else {
                                        t = moment.duration( remainingTime );
                                        timeString = t.humanize();
diff --git a/resources/mw.UploadWizard.js b/resources/mw.UploadWizard.js
index 69a9914..fc97084 100644
--- a/resources/mw.UploadWizard.js
+++ b/resources/mw.UploadWizard.js
@@ -32,7 +32,7 @@
 
                this.allowCloseWindow = mw.confirmCloseWindow( {
                        message: function () {
-                               return mw.message( 'mwe-upwiz-prevent-close' 
).escaped();
+                               return mw.message( 'mwe-upwiz-prevent-close' 
).text();
                        },
 
                        test: function () {
@@ -182,7 +182,7 @@
                        $( '#mwe-upwiz-add-file-container, 
#mwe-upwiz-upload-ctrl-flickr-container' ).hide();
 
                        // Add placeholder text to the Flickr URL input field
-                       $flickrInput.placeholder( mw.message( 
'mwe-upwiz-flickr-input-placeholder' ).escaped() );
+                       $flickrInput.placeholder( mw.message( 
'mwe-upwiz-flickr-input-placeholder' ).text() );
 
                        // Insert form into the page
                        $( '#mwe-upwiz-files' ).prepend( $flickrContainer );
diff --git a/resources/mw.UploadWizardDetails.js 
b/resources/mw.UploadWizardDetails.js
index f1b7bcc..d1284a3 100644
--- a/resources/mw.UploadWizardDetails.js
+++ b/resources/mw.UploadWizardDetails.js
@@ -161,8 +161,8 @@
 
                // Add in remove control to submittingDiv
                this.removeCtrl = new OO.ui.ButtonWidget( {
-                       label: mw.message( 'mwe-upwiz-remove' ).escaped(),
-                       title: mw.message( 'mwe-upwiz-remove-upload' 
).escaped(),
+                       label: mw.message( 'mwe-upwiz-remove' ).text(),
+                       title: mw.message( 'mwe-upwiz-remove-upload' ).text(),
                        flags: 'destructive',
                        icon: 'remove',
                        framed: false
@@ -1076,7 +1076,7 @@
                                } else {
                                        statusKey = 'api-error-' + code;
                                        if ( code === 'filetype-banned' && 
result.error.blacklisted ) {
-                                               comma = mw.message( 
'comma-separator' ).escaped();
+                                               comma = mw.message( 
'comma-separator' ).text();
                                                code = 'filetype-banned-type';
                                                statusLine = mw.message( 
'api-error-filetype-banned-type',
                                                        
result.error.blacklisted.join( comma ),
diff --git a/resources/mw.UploadWizardUpload.js 
b/resources/mw.UploadWizardUpload.js
index da20c4d..73e298a 100644
--- a/resources/mw.UploadWizardUpload.js
+++ b/resources/mw.UploadWizardUpload.js
@@ -201,7 +201,7 @@
                        }
                        if ( code === 'filetype-banned' && 
result.error.blacklisted ) {
                                code = 'filetype-banned-type';
-                               comma = mw.message( 'comma-separator' 
).escaped();
+                               comma = mw.message( 'comma-separator' ).text();
                                info = [
                                        result.error.blacklisted.join( comma ),
                                        result.error.allowed.join( comma ),
@@ -238,7 +238,7 @@
                                                code = 'unknown-warning';
                                                if ( typeof 
result.upload.warnings[ warnCode ] === 'string' ) {
                                                        // tack the original 
error code onto the warning info
-                                                       info = warnCode + 
mw.message( 'colon-separator' ).escaped() + result.upload.warnings[ warnCode ];
+                                                       info = warnCode + 
mw.message( 'colon-separator' ).text() + result.upload.warnings[ warnCode ];
                                                } else {
                                                        info = 
result.upload.warnings[ warnCode ];
                                                }
diff --git a/resources/mw.UploadWizardUploadInterface.js 
b/resources/mw.UploadWizardUploadInterface.js
index 322474c..5b7f69a 100644
--- a/resources/mw.UploadWizardUploadInterface.js
+++ b/resources/mw.UploadWizardUploadInterface.js
@@ -49,8 +49,8 @@
                        );
 
                this.removeCtrl = new OO.ui.ButtonWidget( {
-                       label: mw.message( 'mwe-upwiz-remove' ).escaped(),
-                       title: mw.message( 'mwe-upwiz-remove-upload' 
).escaped(),
+                       label: mw.message( 'mwe-upwiz-remove' ).text(),
+                       title: mw.message( 'mwe-upwiz-remove-upload' ).text(),
                        flags: 'destructive',
                        icon: 'remove',
                        framed: false
@@ -175,7 +175,7 @@
         * @param {string} s
         */
        mw.UploadWizardUploadInterface.prototype.setStatusString = function ( s 
) {
-               $( this.div ).find( '.mwe-upwiz-file-status' ).html( s ).show();
+               $( this.div ).find( '.mwe-upwiz-file-status' ).text( s ).show();
        };
 
        /**
diff --git a/resources/mw.units.js b/resources/mw.units.js
index ff93174..1802cfb 100644
--- a/resources/mw.units.js
+++ b/resources/mw.units.js
@@ -18,7 +18,7 @@
                                size /= 1024.0;
                                i++;
                        }
-                       return mw.message( scaleMsgKeys[ i ], size.toFixed( i > 
1 ? 2 : 0 ) ).escaped();
+                       return mw.message( scaleMsgKeys[ i ], size.toFixed( i > 
1 ? 2 : 0 ) ).text();
                }
        };
 
diff --git a/resources/ui/steps/uw.ui.Tutorial.js 
b/resources/ui/steps/uw.ui.Tutorial.js
index 27d646d..10ebb3e 100644
--- a/resources/ui/steps/uw.ui.Tutorial.js
+++ b/resources/ui/steps/uw.ui.Tutorial.js
@@ -73,8 +73,8 @@
                                $content: $( '<p>' ).msg(
                                        'mwe-upwiz-tooltip-skiptutorial',
                                        mw.config.get( 'wgServer' ) + 
mw.util.getUrl( 'Special:Preferences' ) + '#mw-prefsection-uploads',
-                                       mw.message( 'prefs-uploads' ).escaped(),
-                                       mw.message( 'prefs-upwiz-interface' 
).escaped()
+                                       mw.message( 'prefs-uploads' ).text(),
+                                       mw.message( 'prefs-upwiz-interface' 
).text()
                                ),
                                autoClose: false,
                                padded: true

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib787ab5a3a546cbae8fadb5bf31cb356755a95db
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>

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

Reply via email to