Merge "Add mw-content-ltr|rtl to file redirect pages"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 3 May 2017 14:21:38 +0000 (14:21 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 3 May 2017 14:21:38 +0000 (14:21 +0000)
1  2 
includes/skins/SkinTemplate.php

@@@ -61,7 -61,7 +61,7 @@@ class SkinTemplate extends Skin 
         *
         * @param OutputPage $out
         */
 -      function setupSkinUserCss( OutputPage $out ) {
 +      public function setupSkinUserCss( OutputPage $out ) {
                $moduleStyles = [
                        'mediawiki.legacy.shared',
                        'mediawiki.legacy.commonPrint',
                # An ID that includes the actual body text; without categories, contentSub, ...
                $realBodyAttribs = [ 'id' => 'mw-content-text' ];
  
-               # Add a mw-content-ltr/rtl class to be able to style based on text direction
-               # when the content is different from the UI language, i.e.:
-               # not for special pages or file pages AND only when viewing
-               if ( !in_array( $title->getNamespace(), [ NS_SPECIAL, NS_FILE ] ) &&
-                       Action::getActionName( $this ) === 'view' ) {
+               # Add a mw-content-ltr/rtl class to be able to style based on text
+               # direction when the content is different from the UI language (only
+               # when viewing)
+               # Most information on special pages and file pages is in user language,
+               # rather than content language, so those will not get this
+               if ( Action::getActionName( $this ) === 'view' &&
+                       ( !$title->inNamespaces( NS_SPECIAL, NS_FILE ) || $title->isRedirect() ) ) {
                        $pageLang = $title->getPageViewLanguage();
                        $realBodyAttribs['lang'] = $pageLang->getHtmlCode();
                        $realBodyAttribs['dir'] = $pageLang->getDir();
                $tpl->set( 'charset', 'UTF-8' );
                $tpl->setRef( 'wgScript', $wgScript );
                $tpl->setRef( 'skinname', $this->skinname );
 -              $tpl->set( 'skinclass', get_class( $this ) );
 +              $tpl->set( 'skinclass', static::class );
                $tpl->setRef( 'skin', $this );
                $tpl->setRef( 'stylename', $this->stylename );
                $tpl->set( 'printable', $out->isPrintable() );
                /* set up the default links for the personal toolbar */
                $personal_urls = [];
  
 -              # Due to bug 32276, if a user does not have read permissions,
 +              # Due to T34276, if a user does not have read permissions,
                # $this->getTitle() will just give Special:Badtitle, which is
                # not especially useful as a returnto parameter. Use the title
                # from the request instead, if there was one.
                                        'text' => $this->msg( 'pt-userlogout' )->text(),
                                        'href' => self::makeSpecialUrl( 'Userlogout',
                                                // userlogout link must always contain an & character, otherwise we might not be able
 -                                              // to detect a buggy precaching proxy (bug 17790)
 +                                              // to detect a buggy precaching proxy (T19790)
                                                $title->isSpecial( 'Preferences' ) ? 'noreturnto' : $returnto ),
                                        'active' => false
                                ];
                        }
  
                        if ( $authManager->canAuthenticateNow() ) {
 -                              $personal_urls['login'] = $login_url;
 +                              $key = User::groupHasPermission( '*', 'read' )
 +                                      ? 'login'
 +                                      : 'login-private';
 +                              $personal_urls[$key] = $login_url;
                        }
                }
  
                        $content_navigation['namespaces']['special'] = [
                                'class' => 'selected',
                                'text' => $this->msg( 'nstab-special' )->text(),
 -                              'href' => $request->getRequestURL(), // @see: bug 2457, bug 2510
 +                              'href' => $request->getRequestURL(), // @see: T4457, T4510
                                'context' => 'subject'
                        ];
  
                                'href' => $this->getTitle()->getLocalURL( "action=info" )
                        ];
  
 -                      if ( $this->getTitle()->exists() ) {
 +                      if ( $this->getTitle()->exists() || $this->getTitle()->inNamespace( NS_CATEGORY ) ) {
                                $nav_urls['recentchangeslinked'] = [
                                        'href' => SpecialPage::getTitleFor( 'Recentchangeslinked', $this->thispage )->getLocalURL()
                                ];