From ee02653eaf513be6befcf4e371da1556d746580b Mon Sep 17 00:00:00 2001 From: Dayllan Maza Date: Wed, 5 Dec 2018 00:35: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. The check on the block type is being added to keep it in sync with what it is currently being done on core. Bug: T203171 Change-Id: I00ebb5cbcb1ec14e778c2936187cbcebc0829163 --- includes/ApiVisualEditor.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/includes/ApiVisualEditor.php b/includes/ApiVisualEditor.php index 324632d319..21cb078133 100644 --- a/includes/ApiVisualEditor.php +++ b/includes/ApiVisualEditor.php @@ -503,6 +503,7 @@ class ApiVisualEditor extends ApiBase { $targetUsername, /* allow IP users*/ false ); + $block = $targetUser->getBlock(); if ( !( $targetUser && $targetUser->isLoggedIn() ) && @@ -512,8 +513,13 @@ class ApiVisualEditor extends ApiBase { $notices[] = "
\n" . $this->msg( 'userpage-userdoesnotexist', wfEscapeWikiText( $targetUsername ) ) . "\n
"; - } elseif ( $targetUser->isBlocked() ) { - // Show log extract if the user is currently blocked + } elseif ( + !is_null( $block ) && + $block->getType() != Block::TYPE_AUTO && + ( $block->isSitewide() || $targetUser->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 $notices[] = $this->msg( 'blocked-notice-logextract', // Support GENDER in notice