From 65bd5b5e6541063c9e633659d2a9a90c8bcdea6b Mon Sep 17 00:00:00 2001 From: Dayllan Maza Date: Fri, 30 Nov 2018 00:14:38 -0500 Subject: [PATCH] Change rules when displaying block log extract Show log extract if the user is sitewide blocked, or is partially blocked and not allowed to edit their user page or user talk page. Bug: T203171 Change-Id: I9bcc50cfc1fad23f6bbbe5374a9a866f77bebc11 --- includes/EditPage.php | 11 ++++++++--- includes/page/Article.php | 9 +++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index 9e278afcf8..400ea47367 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1969,7 +1969,7 @@ ERROR; return $status; } - if ( $user->isBlockedFrom( $this->mTitle, false ) ) { + if ( $user->isBlockedFrom( $this->mTitle ) ) { // Auto-block user's IP if the account was "hard" blocked if ( !wfReadOnly() ) { $user->spreadAnyEditBlock(); @@ -2611,8 +2611,13 @@ ERROR; if ( !( $user && $user->isLoggedIn() ) && !$ip ) { # User does not exist $out->wrapWikiMsg( "
\n$1\n
", [ 'userpage-userdoesnotexist', wfEscapeWikiText( $username ) ] ); - } elseif ( !is_null( $block ) && $block->getType() != Block::TYPE_AUTO ) { - # Show log extract if the user is currently blocked + } elseif ( + !is_null( $block ) && + $block->getType() != Block::TYPE_AUTO && + ( $block->isSitewide() || $user->isBlockedFrom( $this->mTitle ) ) + ) { + // Show log extract if the user is sitewide blocked or is partially + // blocked and not allowed to edit their user page or user talk page LogEventsList::showLogExtract( $out, 'block', diff --git a/includes/page/Article.php b/includes/page/Article.php index 9f7f280ba0..c7c2c7f4ae 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -1367,8 +1367,13 @@ class Article implements Page { if ( !( $user && $user->isLoggedIn() ) && !$ip ) { # User does not exist $outputPage->wrapWikiMsg( "
\n\$1\n
", [ 'userpage-userdoesnotexist-view', wfEscapeWikiText( $rootPart ) ] ); - } elseif ( !is_null( $block ) && $block->getType() != Block::TYPE_AUTO ) { - # Show log extract if the user is currently blocked + } elseif ( + !is_null( $block ) && + $block->getType() != Block::TYPE_AUTO && + ( $block->isSitewide() || $user->isBlockedFrom( $title ) ) + ) { + // Show log extract if the user is sitewide blocked or is partially + // blocked and not allowed to edit their user page or user talk page LogEventsList::showLogExtract( $outputPage, 'block', -- 2.20.1