From 4cebf7f4f05418fafb42ce792143b7051d853045 Mon Sep 17 00:00:00 2001 From: JuneHyeon Bae Date: Fri, 30 May 2014 21:34:42 +0900 Subject: [PATCH] Do not show user blocked warning on included Special:Contributions page 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 | 1 + includes/specials/SpecialContributions.php | 48 +++++++++++----------- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/RELEASE-NOTES-1.24 b/RELEASE-NOTES-1.24 index 2f41347c7d..8e9522277b 100644 --- a/RELEASE-NOTES-1.24 +++ b/RELEASE-NOTES-1.24 @@ -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 diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index a1e8d2bf1c..05bbb5ab2b 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -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 + ) + ); + } } } -- 2.20.1