r98495 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98494‎ | r98495 | r98496 >
Date:00:48, 30 September 2011
Author:johnduhart
Status:resolved (Comments)
Tags:
Comment:
Followup r95572, minor tweaks per CR
Modified paths:
  • /trunk/extensions/AbuseFilter/AbuseFilter.php (modified) (history)
  • /trunk/extensions/AbuseFilter/api/ApiAbuseFilterCheckMatch.php (modified) (history)
  • /trunk/extensions/AbuseFilter/api/ApiAbuseFilterUnblockAutopromote.php (modified) (history)
  • /trunk/extensions/AbuseFilter/modules/ext.abuseFilter.edit.js (modified) (history)
  • /trunk/extensions/AbuseFilter/modules/ext.abuseFilter.tools.js (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/AbuseFilter.php
@@ -110,7 +110,8 @@
111111 'scripts' => 'ext.abuseFilter.edit.js',
112112 'messages' => array(
113113 'abusefilter-edit-syntaxok',
114 - 'abusefilter-edit-syntaxerr'
 114+ 'abusefilter-edit-syntaxerr',
 115+ 'unknown-error',
115116 ),
116117 'dependencies' => array(
117118 'jquery.textSelection',
Index: trunk/extensions/AbuseFilter/modules/ext.abuseFilter.edit.js
@@ -61,6 +61,13 @@
6262 .show()
6363 .removeClass('mw-abusefilter-syntaxresult-ok mw-abusefilter-syntaxresult-error');
6464
 65+ if ( data === undefined ) {
 66+ $el.text( mw.msg( 'unknown-error' ) )
 67+ .attr( 'class', 'mw-abusefilter-syntaxresult-error' )
 68+ .data( 'syntaxOk', false );
 69+ return;
 70+ }
 71+
6572 if ( data.status == 'ok' ) {
6673 // Successful
6774 $el.text( mw.msg( 'abusefilter-edit-syntaxok' ) )
@@ -115,7 +122,9 @@
116123 abflimit: 1
117124 }, function ( data ) {
118125 $.removeSpinner( 'fetch-spinner' );
119 - $filterBox.text( data.query.abusefilters[0].pattern );
 126+ if ( data.query.abusefilters[0] !== undefined ) {
 127+ $filterBox.text( data.query.abusefilters[0].pattern );
 128+ }
120129 }
121130 );
122131 };
@@ -126,6 +135,7 @@
127136 */
128137 this.hideDeselectedActions = function() {
129138 $( 'input.mw-abusefilter-action-checkbox' ).each( function() {
 139+ // mw-abusefilter-action-checkbox-{$action}
130140 var action = this.id.substr( 31 );
131141 var $params = $( '#mw-abusefilter-' + action + '-parameters' );
132142
@@ -149,7 +159,7 @@
150160 title: 'MediaWiki:' + message,
151161 action: 'render'
152162 }, function( data ) {
153 - $( '#mw-abusefilter-warn-preview' ).html( data )
 163+ $( '#mw-abusefilter-warn-preview' ).html( data )
154164 } );
155165 };
156166
Index: trunk/extensions/AbuseFilter/modules/ext.abuseFilter.tools.js
@@ -31,7 +31,7 @@
3232 $.removeSpinner( 'abusefilter-expr' );
3333
3434 $( '#mw-abusefilter-expr-result' )
35 - .html( mw.html.escape( data.abusefilterevalexpression.result ) );
 35+ .text( mw.html.escape( data.abusefilterevalexpression.result ) );
3636 };
3737
3838 /**
Index: trunk/extensions/AbuseFilter/api/ApiAbuseFilterCheckMatch.php
@@ -12,7 +12,7 @@
1313 }
1414
1515 if ( $params['vars'] ) {
16 - $vars = json_decode( $params['vars'], true );
 16+ $vars = FormatJson::decode( $params['vars'], true );
1717 } elseif ( $params['rcid'] ) {
1818 $dbr = wfGetDB( DB_SLAVE );
1919 $row = $dbr->selectRow(
Index: trunk/extensions/AbuseFilter/api/ApiAbuseFilterUnblockAutopromote.php
@@ -12,7 +12,7 @@
1313 $user = User::newFromName( $params['user'] );
1414
1515 if ( $user === false ) {
16 - // Same as below
 16+ // Oh god this is so bad but this message uses GENDER
1717 $msg = wfMsgExt( 'abusefilter-reautoconfirm-none', array( 'parsemag' ), $params['user'] );
1818 $this->dieUsage( $msg, 'notsuspended' );
1919 }
@@ -21,7 +21,7 @@
2222 $key = AbuseFilter::autoPromoteBlockKey( $user );
2323
2424 if ( !$wgMemc->get( $key ) ) {
25 - // Oh god this is so bad but this message uses GENDER
 25+ // Same as above :(
2626 $msg = wfMsgExt( 'abusefilter-reautoconfirm-none', array( 'parsemag' ), $params['user'] );
2727 $this->dieUsage( $msg, 'notsuspended' );
2828 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r107805Followup r98495, fix double escapingjohnduhart08:02, 2 January 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r95572Adds ResourceLoader support to AbuseFilter...johnduhart20:12, 26 August 2011

Comments

#Comment by Nikerabbit (talk | contribs)   07:56, 2 January 2012
+			.text( mw.html.escape( data.abusefilterevalexpression.result ) );

This looks like double escaping. Rest looks fine.

Status & tagging log