Show block notice on contribs for range-blocked IP
Also on deleted contribs, user, user talk pages. Bug: 20790 Change-Id: I3ed9cb56f91b52fdb0ba452422f9d0723e9abe41
This commit is contained in:
parent
c313a75c80
commit
2b438eb5c1
5 changed files with 21 additions and 7 deletions
|
|
@ -94,6 +94,8 @@ production.
|
|||
* 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
|
||||
|
|
|
|||
|
|
@ -2236,14 +2236,15 @@ class EditPage {
|
|||
$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,
|
||||
|
|
|
|||
|
|
@ -1163,15 +1163,16 @@ class Article implements Page {
|
|||
$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,
|
||||
|
|
|
|||
|
|
@ -270,7 +270,12 @@ 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.
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -472,7 +472,12 @@ class DeletedContributionsPage extends SpecialPage {
|
|||
$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(
|
||||
|
|
@ -485,7 +490,7 @@ class DeletedContributionsPage extends SpecialPage {
|
|||
'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
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue