Collapse some nested if statements
[lhc/web/wiklou.git] / includes / specials / SpecialContributions.php
index 84121b2..08a7fde 100644 (file)
@@ -45,6 +45,7 @@ class SpecialContributions extends IncludableSpecialPage {
                        'mediawiki.special',
                        'mediawiki.special.changeslist',
                ] );
+               $out->addModules( 'mediawiki.special.recentchanges' );
                $this->addHelpLink( 'Help:User contributions' );
 
                $this->opts = [];
@@ -243,9 +244,9 @@ class SpecialContributions extends IncludableSpecialPage {
 
                                $output = $pager->getBody();
                                if ( !$this->including() ) {
-                                       $output = '<p>' . $pager->getNavigationBar() . '</p>' .
+                                       $output = $pager->getNavigationBar() .
                                                $output .
-                                               '<p>' . $pager->getNavigationBar() . '</p>';
+                                               $pager->getNavigationBar();
                                }
                                $out->addHTML( $output );
                        }
@@ -266,14 +267,10 @@ class SpecialContributions extends IncludableSpecialPage {
                                $message = 'sp-contributions-footer';
                        }
 
-                       if ( $message ) {
-                               if ( !$this->including() ) {
-                                       if ( !$this->msg( $message, $target )->isDisabled() ) {
-                                               $out->wrapWikiMsg(
-                                                       "<div class='mw-contributions-footer'>\n$1\n</div>",
-                                                       [ $message, $target ] );
-                                       }
-                               }
+                       if ( $message && !$this->including() && !$this->msg( $message, $target )->isDisabled() ) {
+                               $out->wrapWikiMsg(
+                                       "<div class='mw-contributions-footer'>\n$1\n</div>",
+                                       [ $message, $target ] );
                        }
                }
        }
@@ -312,7 +309,11 @@ class SpecialContributions extends IncludableSpecialPage {
                $links = '';
                if ( $talk ) {
                        $tools = self::getUserLinks( $this, $userObj );
-                       $links = $this->getLanguage()->pipeList( $tools );
+                       $links = Html::openElement( 'span', [ 'class' => 'mw-changeslist-links' ] );
+                       foreach ( $tools as $tool ) {
+                               $links .= Html::rawElement( 'span', [], $tool ) . ' ';
+                       }
+                       $links = trim( $links ) . Html::closeElement( 'span' );
 
                        // Show a note if the user is blocked and display the last block log entry.
                        // Do not expose the autoblocks, since that may lead to a leak of accounts' IPs,
@@ -352,7 +353,10 @@ class SpecialContributions extends IncludableSpecialPage {
                        }
                }
 
-               return $this->msg( 'contribsub2' )->rawParams( $user, $links )->params( $userObj->getName() );
+               return Html::rawElement( 'div', [ 'class' => 'mw-contributions-user-tools' ],
+                       $this->msg( 'contributions-subtitle' )->rawParams( $user )->params( $userObj->getName() )
+                       . ' ' . $links
+               );
        }
 
        /**
@@ -587,6 +591,7 @@ class SpecialContributions extends IncludableSpecialPage {
                        $this->opts['target'],
                        'text',
                        [
+                               'id' => 'mw-target-user-or-ip',
                                'size' => '40',
                                'class' => [
                                        'mw-input',
@@ -606,6 +611,7 @@ class SpecialContributions extends IncludableSpecialPage {
                        $labelNewbies . '<br>' . $labelUsername . ' ' . $input . ' '
                );
 
+               $hidden = $this->opts['namespace'] === '' ? ' mw-input-hidden' : '';
                $namespaceSelection = Xml::tags(
                        'div',
                        [],
@@ -624,11 +630,11 @@ class SpecialContributions extends IncludableSpecialPage {
                        ) . "\u{00A0}" .
                                Html::rawElement(
                                        'span',
-                                       [ 'class' => 'mw-input-with-label' ],
+                                       [ 'class' => 'mw-input-with-label' . $hidden ],
                                        Xml::checkLabel(
                                                $this->msg( 'invert' )->text(),
                                                'nsInvert',
-                                               'nsInvert',
+                                               'nsinvert',
                                                $this->opts['nsInvert'],
                                                [
                                                        'title' => $this->msg( 'tooltip-invert' )->text(),
@@ -636,11 +642,11 @@ class SpecialContributions extends IncludableSpecialPage {
                                                ]
                                        ) . "\u{00A0}"
                                ) .
-                               Html::rawElement( 'span', [ 'class' => 'mw-input-with-label' ],
+                               Html::rawElement( 'span', [ 'class' => 'mw-input-with-label' . $hidden ],
                                        Xml::checkLabel(
                                                $this->msg( 'namespace_association' )->text(),
                                                'associated',
-                                               'associated',
+                                               'nsassociated',
                                                $this->opts['associated'],
                                                [
                                                        'title' => $this->msg( 'tooltip-namespace_association' )->text(),