Merge "LogEventsList: Remove options not used by HTMLForm"
[lhc/web/wiklou.git] / includes / specials / SpecialContributions.php
index 806713b..f5e2b86 100644 (file)
@@ -50,11 +50,7 @@ class SpecialContributions extends IncludableSpecialPage {
                $this->opts = [];
                $request = $this->getRequest();
 
-               if ( $par !== null ) {
-                       $target = $par;
-               } else {
-                       $target = $request->getVal( 'target' );
-               }
+               $target = $par ?? $request->getVal( 'target' );
 
                if ( $request->getVal( 'contribs' ) == 'newbie' || $par === 'newbies' ) {
                        $target = 'newbies';
@@ -81,21 +77,39 @@ class SpecialContributions extends IncludableSpecialPage {
                $this->opts['newOnly'] = $request->getBool( 'newOnly' );
                $this->opts['hideMinor'] = $request->getBool( 'hideMinor' );
 
-               $nt = Title::makeTitleSafe( NS_USER, $target );
-               if ( !$nt ) {
-                       $out->addHTML( $this->getForm() );
-
-                       return;
-               }
-               $userObj = User::newFromName( $nt->getText(), false );
-               if ( !$userObj ) {
-                       $out->addHTML( $this->getForm() );
+               $id = 0;
+               if ( $this->opts['contribs'] === 'newbie' ) {
+                       $userObj = User::newFromName( $target ); // hysterical raisins
+                       $out->addSubtitle( $this->msg( 'sp-contributions-newbies-sub' ) );
+                       $out->setHTMLTitle( $this->msg(
+                               'pagetitle',
+                               $this->msg( 'sp-contributions-newbies-title' )->plain()
+                       )->inContentLanguage() );
+               } elseif ( ExternalUserNames::isExternal( $target ) ) {
+                       $userObj = User::newFromName( $target, false );
+                       if ( !$userObj ) {
+                               $out->addHTML( $this->getForm() );
+                               return;
+                       }
 
-                       return;
-               }
-               $id = $userObj->getId();
+                       $out->addSubtitle( $this->contributionsSub( $userObj ) );
+                       $out->setHTMLTitle( $this->msg(
+                               'pagetitle',
+                               $this->msg( 'contributions-title', $target )->plain()
+                       )->inContentLanguage() );
+               } else {
+                       $nt = Title::makeTitleSafe( NS_USER, $target );
+                       if ( !$nt ) {
+                               $out->addHTML( $this->getForm() );
+                               return;
+                       }
+                       $userObj = User::newFromName( $nt->getText(), false );
+                       if ( !$userObj ) {
+                               $out->addHTML( $this->getForm() );
+                               return;
+                       }
+                       $id = $userObj->getId();
 
-               if ( $this->opts['contribs'] != 'newbie' ) {
                        $target = $nt->getText();
                        $out->addSubtitle( $this->contributionsSub( $userObj ) );
                        $out->setHTMLTitle( $this->msg(
@@ -108,12 +122,6 @@ class SpecialContributions extends IncludableSpecialPage {
                        if ( !IP::isValidRange( $target ) ) {
                                $this->getSkin()->setRelevantUser( $userObj );
                        }
-               } else {
-                       $out->addSubtitle( $this->msg( 'sp-contributions-newbies-sub' ) );
-                       $out->setHTMLTitle( $this->msg(
-                               'pagetitle',
-                               $this->msg( 'sp-contributions-newbies-title' )->plain()
-                       )->inContentLanguage() );
                }
 
                $ns = $request->getVal( 'namespace', null );
@@ -544,7 +552,7 @@ class SpecialContributions extends IncludableSpecialPage {
                        $filterSelection = Html::rawElement(
                                'div',
                                [],
-                               implode( ' ', $tagFilter )
+                               implode( "\u{00A0}", $tagFilter )
                        );
                } else {
                        $filterSelection = Html::rawElement( 'div', [], '' );
@@ -597,7 +605,7 @@ class SpecialContributions extends IncludableSpecialPage {
                                $this->msg( 'namespace' )->text(),
                                'namespace',
                                ''
-                       ) . ' ' .
+                       ) . "\u{00A0}" .
                        Html::namespaceSelector(
                                [ 'selected' => $this->opts['namespace'], 'all' => '' ],
                                [
@@ -605,7 +613,7 @@ class SpecialContributions extends IncludableSpecialPage {
                                        'id' => 'namespace',
                                        'class' => 'namespaceselector',
                                ]
-                       ) . ' ' .
+                       ) . "\u{00A0}" .
                                Html::rawElement(
                                        'span',
                                        [ 'class' => 'mw-input-with-label' ],
@@ -618,7 +626,7 @@ class SpecialContributions extends IncludableSpecialPage {
                                                        'title' => $this->msg( 'tooltip-invert' )->text(),
                                                        'class' => 'mw-input'
                                                ]
-                                       ) . ' '
+                                       ) . "\u{00A0}"
                                ) .
                                Html::rawElement( 'span', [ 'class' => 'mw-input-with-label' ],
                                        Xml::checkLabel(
@@ -630,7 +638,7 @@ class SpecialContributions extends IncludableSpecialPage {
                                                        'title' => $this->msg( 'tooltip-namespace_association' )->text(),
                                                        'class' => 'mw-input'
                                                ]
-                                       ) . ' '
+                                       ) . "\u{00A0}"
                                )
                );