Also on deleted contribs, user, user talk pages.
Bug: 20790
Change-Id: I3ed9cb56f91b52fdb0ba452422f9d0723e9abe41
* Upgrade jStorage to v0.4.10.
* {{!}} is now a magic word that produces the | character. This removes the need
for Template:! for purposes such as passing pipes inside of parameters.
+* (bug 20790) The block log snippet on Special:Contributions and while
+ editing user and user talk pages now works for IP range blocks.
=== Bug fixes in 1.24 ===
* (bug 49116) Footer copyright notice is now always displayed in user language
$username = $parts[0];
$user = User::newFromName( $username, false /* allow IP users*/ );
$ip = User::isIP( $username );
+ $block = Block::newFromTarget( $user, $user );
if ( !( $user && $user->isLoggedIn() ) && !$ip ) { # User does not exist
$wgOut->wrapWikiMsg( "<div class=\"mw-userpage-userdoesnotexist error\">\n$1\n</div>",
array( 'userpage-userdoesnotexist', wfEscapeWikiText( $username ) ) );
- } elseif ( $user->isBlocked() ) { # Show log extract if the user is currently blocked
+ } elseif ( !is_null( $block ) && $block->getType() != Block::TYPE_AUTO ) { # Show log extract if the user is currently blocked
LogEventsList::showLogExtract(
$wgOut,
'block',
- $user->getUserPage(),
+ MWNamespace::getCanonicalName( NS_USER ) . ':' . $block->getTarget(),
'',
array(
'lim' => 1,
$rootPart = $parts[0];
$user = User::newFromName( $rootPart, false /* allow IP users*/ );
$ip = User::isIP( $rootPart );
+ $block = Block::newFromTarget( $user, $user );
if ( !( $user && $user->isLoggedIn() ) && !$ip ) { # User does not exist
$outputPage->wrapWikiMsg( "<div class=\"mw-userpage-userdoesnotexist error\">\n\$1\n</div>",
array( 'userpage-userdoesnotexist-view', wfEscapeWikiText( $rootPart ) ) );
- } elseif ( $user->isBlocked() ) { # Show log extract if the user is currently blocked
+ } elseif ( !is_null( $block ) && $block->getType() != Block::TYPE_AUTO ) { # Show log extract if the user is currently blocked
LogEventsList::showLogExtract(
$outputPage,
'block',
- $user->getUserPage(),
+ MWNamespace::getCanonicalName( NS_USER ) . ':' . $block->getTarget(),
'',
array(
'lim' => 1,
// 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.
- if ( $userObj->isBlocked() && $userObj->getBlock()->getType() != Block::TYPE_AUTO ) {
+ $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,
$links = $this->getLanguage()->pipeList( $tools );
// Show a note if the user is blocked and display the last block log entry.
- if ( $userObj->isBlocked() ) {
+ $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();
+ }
+
// LogEventsList::showLogExtract() wants the first parameter by ref
$out = $this->getOutput();
LogEventsList::showLogExtract(
'showIfEmpty' => false,
'msgKey' => array(
'sp-contributions-blocked-notice',
- $nt->getText() # Support GENDER in 'sp-contributions-blocked-notice'
+ $userObj->getName() # Support GENDER in 'sp-contributions-blocked-notice'
),
'offset' => '' # don't use $this->getRequest() parameter offset
)