Skip user namespace prefix for rights log entry
authorumherirrender <umherirrender_de.wp@web.de>
Fri, 9 Oct 2015 20:36:47 +0000 (22:36 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Sat, 10 Oct 2015 05:38:10 +0000 (07:38 +0200)
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
includes/logging/RightsLogFormatter.php
tests/phpunit/includes/logging/RightsLogFormatterTest.php

index 1d31088..e2d9946 100644 (file)
@@ -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" );
index 352bda5..79ffe86 100644 (file)
@@ -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() {
index e9577f1..6e4c589 100644 (file)
@@ -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(),
                                ),
                        ),