Add "wgRelevantUserName" from skin to mw.config
authorumherirrender <umherirrender_de.wp@web.de>
Tue, 29 Oct 2013 20:49:17 +0000 (21:49 +0100)
committerumherirrender <umherirrender_de.wp@web.de>
Tue, 5 Nov 2013 16:59:05 +0000 (17:59 +0100)
A skin can have a relevant user, then some help links in the sidebar
are shown. When a user want extend this informationen with userjs, he
has to parse the existing items or the title param of the url to get the
name of the user for which this help links are shown. Having the name as
javascript variable makes it easier to add more links in the sidebar.

Change-Id: I17a75902b6e739d5149d332b6a94a6568b79501f

RELEASE-NOTES-1.23
includes/OutputPage.php

index 710f26f..9cae57b 100644 (file)
@@ -20,6 +20,8 @@ production.
   enabled with care.
 * (bug 6092) Add expensive parser functions {{REVISIONID:}}, {{REVISIONUSER:}}
   and {{REVISIONTIMESTAMP:}} (with friends).
+* Add "wgRelevantUserName" to mw.config containing the current
+  Skin::getRelevantUser value
 
 === Bug fixes in 1.23 ===
 * (bug 41759) The "updated since last visit" markers (on history pages, recent
index 7f0454f..b4fda13 100644 (file)
@@ -2980,9 +2980,11 @@ $templates
                $ns = $title->getNamespace();
                $canonicalNamespace = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $title->getNsText();
 
+               $sk = $this->getSkin();
                // Get the relevant title so that AJAX features can use the correct page name
                // when making API requests from certain special pages (bug 34972).
-               $relevantTitle = $this->getSkin()->getRelevantTitle();
+               $relevantTitle = $sk->getRelevantTitle();
+               $relevantUser = $sk->getRelevantUser();
 
                if ( $ns == NS_SPECIAL ) {
                        list( $canonicalSpecialPageName, /*...*/ ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
@@ -3059,6 +3061,9 @@ $templates
                if ( $this->mRedirectedFrom ) {
                        $vars['wgRedirectedFrom'] = $this->mRedirectedFrom->getPrefixedDBkey();
                }
+               if ( $relevantUser ) {
+                       $vars['wgRelevantUserName'] = $relevantUser->getName();
+               }
 
                // Allow extensions to add their custom variables to the mw.config map.
                // Use the 'ResourceLoaderGetConfigVars' hook if the variable is not