Do not show user blocked warning on included Special:Contributions page
authorJuneHyeon Bae <devunt@gmail.com>
Fri, 30 May 2014 12:34:42 +0000 (21:34 +0900)
committerAlexandre Emsenhuber <mediawiki@emsenhuber.ch>
Mon, 30 Jun 2014 19:44:21 +0000 (21:44 +0200)
When user included {{Special:Contributions}} page of blocked user,
do not show "this user is blocked" box.

Bug: 65781
Change-Id: I13b80f829dd26bf960b16efea588618c36898a5d

RELEASE-NOTES-1.24
includes/specials/SpecialContributions.php

index 2f41347..8e95222 100644 (file)
@@ -203,6 +203,7 @@ changes to languages because of Bugzilla reports.
 * BREAKING CHANGE: The undocumented Special{$this->getName()}BeforeFormDisplay
   set of hooks has been removed and replaced by a single new hook
   SpecialPageBeforeFormDisplay.
+* (bug 65781) Removed block warning on included {{Special:Contributions}}
 
 ==== Renamed classes ====
 * CLDRPluralRuleConverter_Expression to CLDRPluralRuleConverterExpression
index a1e8d2b..05bbb5a 100644 (file)
@@ -270,30 +270,32 @@ class SpecialContributions extends IncludableSpecialPage {
                        // Show a note if the user is blocked and display the last block log entry.
                        // Do not expose the autoblocks, since that may lead to a leak of accounts' IPs,
                        // and also this will display a totally irrelevant log entry as a current block.
-                       $block = Block::newFromTarget( $userObj, $userObj );
-                       if ( !is_null( $block ) && $block->getType() != Block::TYPE_AUTO ) {
-                               if ( $block->getType() == Block::TYPE_RANGE ) {
-                                       $nt = MWNamespace::getCanonicalName( NS_USER ) . ':' . $block->getTarget();
-                               }
+                       if ( !$this->including() ) {
+                               $block = Block::newFromTarget( $userObj, $userObj );
+                               if ( !is_null( $block ) && $block->getType() != Block::TYPE_AUTO ) {
+                                       if ( $block->getType() == Block::TYPE_RANGE ) {
+                                               $nt = MWNamespace::getCanonicalName( NS_USER ) . ':' . $block->getTarget();
+                                       }
 
-                               $out = $this->getOutput(); // showLogExtract() wants first parameter by reference
-                               LogEventsList::showLogExtract(
-                                       $out,
-                                       'block',
-                                       $nt,
-                                       '',
-                                       array(
-                                               'lim' => 1,
-                                               'showIfEmpty' => false,
-                                               'msgKey' => array(
-                                                       $userObj->isAnon() ?
-                                                               'sp-contributions-blocked-notice-anon' :
-                                                               'sp-contributions-blocked-notice',
-                                                       $userObj->getName() # Support GENDER in 'sp-contributions-blocked-notice'
-                                               ),
-                                               'offset' => '' # don't use WebRequest parameter offset
-                                       )
-                               );
+                                       $out = $this->getOutput(); // showLogExtract() wants first parameter by reference
+                                       LogEventsList::showLogExtract(
+                                               $out,
+                                               'block',
+                                               $nt,
+                                               '',
+                                               array(
+                                                       'lim' => 1,
+                                                       'showIfEmpty' => false,
+                                                       'msgKey' => array(
+                                                               $userObj->isAnon() ?
+                                                                       'sp-contributions-blocked-notice-anon' :
+                                                                       'sp-contributions-blocked-notice',
+                                                               $userObj->getName() # Support GENDER in 'sp-contributions-blocked-notice'
+                                                       ),
+                                                       'offset' => '' # don't use WebRequest parameter offset
+                                               )
+                                       );
+                               }
                        }
                }