Merge "Provide command to adjust phpunit.xml for code coverage"
[lhc/web/wiklou.git] / includes / specials / SpecialContributions.php
index 4f5c150..40c0edf 100644 (file)
@@ -55,13 +55,6 @@ class SpecialContributions extends IncludableSpecialPage {
 
                $target = $par ?? $request->getVal( 'target' );
 
-               if ( $request->getVal( 'contribs' ) == 'newbie' || $par === 'newbies' ) {
-                       $target = 'newbies';
-                       $this->opts['contribs'] = 'newbie';
-               } else {
-                       $this->opts['contribs'] = 'user';
-               }
-
                $this->opts['deletedOnly'] = $request->getBool( 'deletedOnly' );
 
                if ( !strlen( $target ) ) {
@@ -81,14 +74,7 @@ class SpecialContributions extends IncludableSpecialPage {
                $this->opts['hideMinor'] = $request->getBool( 'hideMinor' );
 
                $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 ) ) {
+               if ( ExternalUserNames::isExternal( $target ) ) {
                        $userObj = User::newFromName( $target, false );
                        if ( !$userObj ) {
                                $out->addHTML( $this->getForm() );
@@ -217,7 +203,6 @@ class SpecialContributions extends IncludableSpecialPage {
                        }
                        $pager = new ContribsPager( $this->getContext(), [
                                'target' => $target,
-                               'contribs' => $this->opts['contribs'],
                                'namespace' => $this->opts['namespace'],
                                'tagfilter' => $this->opts['tagfilter'],
                                'start' => $this->opts['start'],
@@ -228,7 +213,7 @@ class SpecialContributions extends IncludableSpecialPage {
                                'hideMinor' => $this->opts['hideMinor'],
                                'nsInvert' => $this->opts['nsInvert'],
                                'associated' => $this->opts['associated'],
-                       ] );
+                       ], $this->getLinkRenderer() );
 
                        if ( IP::isValidRange( $target ) && !$pager->isQueryableRange( $target ) ) {
                                // Valid range, but outside CIDR limit.
@@ -256,9 +241,7 @@ class SpecialContributions extends IncludableSpecialPage {
                        $out->preventClickjacking( $pager->getPreventClickjacking() );
 
                        # Show the appropriate "footer" message - WHOIS tools, etc.
-                       if ( $this->opts['contribs'] == 'newbie' ) {
-                               $message = 'sp-contributions-footer-newbies';
-                       } elseif ( IP::isValidRange( $target ) ) {
+                       if ( IP::isValidRange( $target ) ) {
                                $message = 'sp-contributions-footer-anon-range';
                        } elseif ( IP::isIPAddress( $target ) ) {
                                $message = 'sp-contributions-footer-anon';
@@ -286,7 +269,7 @@ class SpecialContributions extends IncludableSpecialPage {
         */
        protected function contributionsSub( $userObj ) {
                if ( $userObj->isAnon() ) {
-                       // Show a warning message that the user being searched for doesn't exists.
+                       // Show a warning message that the user being searched for doesn't exist.
                        // User::isIP returns true for IP address and usemod IPs like '123.123.123.xxx',
                        // but returns false for IP ranges. We don't want to suggest either of these are
                        // valid usernames which we would with the 'contributions-userdoesnotexist' message.
@@ -381,6 +364,7 @@ class SpecialContributions extends IncludableSpecialPage {
 
                $linkRenderer = $sp->getLinkRenderer();
 
+               $tools = [];
                # No talk pages for IP ranges.
                if ( !$isRange ) {
                        $tools['user-talk'] = $linkRenderer->makeLink(
@@ -491,10 +475,6 @@ class SpecialContributions extends IncludableSpecialPage {
                        $this->opts['associated'] = false;
                }
 
-               if ( !isset( $this->opts['contribs'] ) ) {
-                       $this->opts['contribs'] = 'user';
-               }
-
                if ( !isset( $this->opts['start'] ) ) {
                        $this->opts['start'] = '';
                }
@@ -503,10 +483,6 @@ class SpecialContributions extends IncludableSpecialPage {
                        $this->opts['end'] = '';
                }
 
-               if ( $this->opts['contribs'] == 'newbie' ) {
-                       $this->opts['target'] = '';
-               }
-
                if ( !isset( $this->opts['tagfilter'] ) ) {
                        $this->opts['tagfilter'] = '';
                }
@@ -578,21 +554,9 @@ class SpecialContributions extends IncludableSpecialPage {
                        $filterSelection = Html::rawElement( 'div', [], '' );
                }
 
-               $labelNewbies = Xml::radioLabel(
-                       $this->msg( 'sp-contributions-newbies' )->text(),
-                       'contribs',
-                       'newbie',
-                       'newbie',
-                       $this->opts['contribs'] == 'newbie',
-                       [ 'class' => 'mw-input' ]
-               );
-               $labelUsername = Xml::radioLabel(
+               $labelUsername = Xml::label(
                        $this->msg( 'sp-contributions-username' )->text(),
-                       'contribs',
-                       'user',
-                       'user',
-                       $this->opts['contribs'] == 'user',
-                       [ 'class' => 'mw-input' ]
+                       'mw-target-user-or-ip'
                );
                $input = Html::input(
                        'target',
@@ -607,16 +571,15 @@ class SpecialContributions extends IncludableSpecialPage {
                                        'mw-autocomplete-user', // used by mediawiki.userSuggest
                                ],
                        ] + (
-                               // Only autofocus if target hasn't been specified or in non-newbies mode
-                               ( $this->opts['contribs'] === 'newbie' || $this->opts['target'] )
-                                       ? [] : [ 'autofocus' => true ]
-                               )
+                               // Only autofocus if target hasn't been specified
+                               $this->opts['target'] ? [] : [ 'autofocus' => true ]
+                       )
                );
 
                $targetSelection = Html::rawElement(
                        'div',
                        [],
-                       $labelNewbies . '<br>' . $labelUsername . ' ' . $input . ' '
+                       $labelUsername . ' ' . $input . ' '
                );
 
                $hidden = $this->opts['namespace'] === '' ? ' mw-input-hidden' : '';