(bug 42337) Simplify "my talk" link logic in personal tools
authorAmir E. Aharoni <amir.aharoni@mail.huji.ac.il>
Thu, 22 Nov 2012 21:57:02 +0000 (23:57 +0200)
committerAmir E. Aharoni <amir.aharoni@mail.huji.ac.il>
Thu, 22 Nov 2012 21:57:02 +0000 (23:57 +0200)
Change I822a7390 introduced a somewhat complex way to display
the "talk" link in parentheses after the username. It would only
work in Vector, and it broke the display in RTL wikis, because
it hacked into the personal links array.

This change attempts to make it more robust, by keeping the
array intact and adding the parentheses to the mytalk item
as a special case in SkinTemplate::makeListItem(). This fixes
the display in RTL wikis and allows the parentheses
to be displayed in all skins.

This commit also eliminates the global $wgVectorCombineUserTalk,
which is not needed any more.

Change-Id: I36ec3bec89a17cab3e4fc56ccf5038f7df93d213

includes/DefaultSettings.php
includes/SkinTemplate.php
skins/Vector.php

index 60c3ab8..77a9de1 100644 (file)
@@ -2776,13 +2776,6 @@ $wgFooterIcons = array(
  */
 $wgUseCombinedLoginLink = false;
 
-/**
- *  Appearance of user page and talk page labels in personal tools.
- *  - true = combine links into a single label
- *  - false = keep links in separate labels
- */
-$wgVectorCombineUserTalk = false;
-
 /**
  * Search form look for Vector skin only.
  *  - true = use an icon search button
index 173d37a..a24ece5 100644 (file)
@@ -1777,6 +1777,13 @@ abstract class BaseTemplate extends QuickTemplate {
                        $attrs['class'] .= ' active';
                        $attrs['class'] = trim( $attrs['class'] );
                }
+
+               // A special case for the talk link in personal tools.
+               // See bug 41672 and 42337.
+               if ( $key === 'mytalk' ) {
+                       $html = $this->getMsg( 'parentheses' )->rawParams( $html )->escaped();
+               }
+
                return Html::rawElement( isset( $options['tag'] ) ? $options['tag'] : 'li', $attrs, $html );
        }
 
index 92eb3ad..8d685bd 100644 (file)
@@ -367,7 +367,7 @@ class VectorTemplate extends BaseTemplate {
         * @param $elements array
         */
        protected function renderNavigation( $elements ) {
-               global $wgVectorUseSimpleSearch, $wgVectorCombineUserTalk;
+               global $wgVectorUseSimpleSearch;
 
                // If only one element was given, wrap it in an array, allowing more
                // flexible arguments
@@ -452,20 +452,6 @@ class VectorTemplate extends BaseTemplate {
        <ul<?php $this->html( 'userlangattributes' ) ?>>
 <?php
                                        $personalTools = $this->getPersonalTools();
-                                       if ( $wgVectorCombineUserTalk && isset( $personalTools['userpage'] ) ) {
-?>
-               <li>
-<?php
-                                               echo $this->makeListItem( 'userpage', $personalTools['userpage'], array( 'tag' => 'span' ) );
-?> <?php
-                                               $personalTools['mytalk']['links'][0]['text'] = $this->getMsg( 'mytalk-parenthetical' )->text();
-                                               $talkItem = $this->makeListItem( 'mytalk', $personalTools['mytalk'], array( 'tag' => 'span' ) );
-                                               echo $this->getMsg( 'parentheses' )->rawParams( $talkItem )->escaped();
-                                               unset( $personalTools['userpage'], $personalTools['mytalk'] );
-?>
-               </li>
-<?php
-                                       }
                                        foreach ( $personalTools as $key => $item ) {
                                                echo $this->makeListItem( $key, $item );
                                        }