From: Brad Jorsch Date: Sat, 12 May 2018 12:03:04 +0000 (-0400) Subject: User: System block reasons shouldn't expand templates X-Git-Tag: 1.34.0-rc.0~5430^2 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=d152ff76a562c536b2088bae9ef4da83332d1a21;p=lhc%2Fweb%2Fwiklou.git User: System block reasons shouldn't expand templates The block reasons for "system" blocks shouldn't expand wikitext templates immediately. That should be left for the code parsing the block reason for display. This should only affect how these blocks are reported to API clients, as when the block is displayed in the web UI it's passed through the parser anyway. The main drawback, as far as the default messages go, is that MediaWiki:sorbsreason won't have {{SITENAME}} expanded in the API response anymore. Bug: T191939 Change-Id: Ib2024721ea0e26358b9b50efdac16316d6d0f0b6 --- diff --git a/includes/user/User.php b/includes/user/User.php index e235c18928..7189bea120 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -1813,14 +1813,14 @@ class User implements IDBAccessObject, UserIdentity { if ( self::isLocallyBlockedProxy( $ip ) ) { $block = new Block( [ 'byText' => wfMessage( 'proxyblocker' )->text(), - 'reason' => wfMessage( 'proxyblockreason' )->text(), + 'reason' => wfMessage( 'proxyblockreason' )->plain(), 'address' => $ip, 'systemBlock' => 'proxy', ] ); } elseif ( $this->isAnon() && $this->isDnsBlacklisted( $ip ) ) { $block = new Block( [ 'byText' => wfMessage( 'sorbs' )->text(), - 'reason' => wfMessage( 'sorbsreason' )->text(), + 'reason' => wfMessage( 'sorbsreason' )->plain(), 'address' => $ip, 'systemBlock' => 'dnsbl', ] ); @@ -1841,7 +1841,7 @@ class User implements IDBAccessObject, UserIdentity { if ( $block instanceof Block ) { # Mangle the reason to alert the user that the block # originated from matching the X-Forwarded-For header. - $block->mReason = wfMessage( 'xffblockreason', $block->mReason )->text(); + $block->mReason = wfMessage( 'xffblockreason', $block->mReason )->plain(); } } @@ -1853,7 +1853,7 @@ class User implements IDBAccessObject, UserIdentity { $block = new Block( [ 'address' => $ip, 'byText' => 'MediaWiki default', - 'reason' => wfMessage( 'softblockrangesreason', $ip )->text(), + 'reason' => wfMessage( 'softblockrangesreason', $ip )->plain(), 'anonOnly' => true, 'systemBlock' => 'wgSoftBlockRanges', ] );