From 5cf7db33fabb3603ce0c07baa3a93ee78ad11b09 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Fri, 9 Oct 2015 22:36:47 +0200 Subject: [PATCH] Skip user namespace prefix for rights log entry The target of the right log entry is shown with namespace prefix, but it is always a user, so skip the namespace prefix. Change-Id: Ibe6005cc70ff3933836166d97c544267fb7d9951 --- includes/logging/LogFormatter.php | 5 +++-- includes/logging/RightsLogFormatter.php | 6 +++--- tests/phpunit/includes/logging/RightsLogFormatterTest.php | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/includes/logging/LogFormatter.php b/includes/logging/LogFormatter.php index 1d31088604..e2d9946b83 100644 --- a/includes/logging/LogFormatter.php +++ b/includes/logging/LogFormatter.php @@ -604,12 +604,13 @@ class LogFormatter { * value in consideration. * @param Title $title The page * @param array $parameters Query parameters + * @param string|null $html Linktext of the link as raw html * @throws MWException * @return string */ - protected function makePageLink( Title $title = null, $parameters = array() ) { + protected function makePageLink( Title $title = null, $parameters = array(), $html = null ) { if ( !$this->plaintext ) { - $link = Linker::link( $title, null, array(), $parameters ); + $link = Linker::link( $title, $html, array(), $parameters ); } else { if ( !$title instanceof Title ) { throw new MWException( "Expected title, got null" ); diff --git a/includes/logging/RightsLogFormatter.php b/includes/logging/RightsLogFormatter.php index 352bda58ca..79ffe867a4 100644 --- a/includes/logging/RightsLogFormatter.php +++ b/includes/logging/RightsLogFormatter.php @@ -29,7 +29,7 @@ * @since 1.21 */ class RightsLogFormatter extends LogFormatter { - protected function makePageLink( Title $title = null, $parameters = array() ) { + protected function makePageLink( Title $title = null, $parameters = array(), $html = null ) { global $wgContLang, $wgUserrightsInterwikiDelimiter; if ( !$this->plaintext ) { @@ -38,7 +38,7 @@ class RightsLogFormatter extends LogFormatter { if ( count( $parts ) === 2 ) { $titleLink = WikiMap::foreignUserLink( $parts[1], $parts[0], - htmlspecialchars( $title->getPrefixedText() ) ); + htmlspecialchars( $title->getText() ) ); if ( $titleLink !== false ) { return $titleLink; @@ -46,7 +46,7 @@ class RightsLogFormatter extends LogFormatter { } } - return parent::makePageLink( $title, $parameters ); + return parent::makePageLink( $title, $parameters, $title ? $title->getText() : null ); } protected function getMessageKey() { diff --git a/tests/phpunit/includes/logging/RightsLogFormatterTest.php b/tests/phpunit/includes/logging/RightsLogFormatterTest.php index e9577f1121..6e4c589504 100644 --- a/tests/phpunit/includes/logging/RightsLogFormatterTest.php +++ b/tests/phpunit/includes/logging/RightsLogFormatterTest.php @@ -25,7 +25,7 @@ class RightsLogFormatterTest extends LogFormatterTestCase { ), ), array( - 'text' => 'Sysop changed group membership for User:User from (none) to ' + 'text' => 'Sysop changed group membership for User from (none) to ' . 'administrator and bureaucrat', 'api' => array( 'oldgroups' => array(), @@ -51,7 +51,7 @@ class RightsLogFormatterTest extends LogFormatterTestCase { ), array( 'legacy' => true, - 'text' => 'Sysop changed group membership for User:User from (none) to ' + 'text' => 'Sysop changed group membership for User from (none) to ' . 'administrator and bureaucrat', 'api' => array( 'oldgroups' => array(), @@ -74,7 +74,7 @@ class RightsLogFormatterTest extends LogFormatterTestCase { ), array( 'legacy' => true, - 'text' => 'Sysop changed group membership for User:User', + 'text' => 'Sysop changed group membership for User', 'api' => array(), ), ), -- 2.20.1