From 7127c1792bb9205d7313ffabb210963c485a2ebc Mon Sep 17 00:00:00 2001 From: umherirrender Date: Tue, 29 Oct 2013 21:49:17 +0100 Subject: [PATCH] Add "wgRelevantUserName" from skin to mw.config 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 | 2 ++ includes/OutputPage.php | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23 index 710f26ff97..9cae57b3d3 100644 --- a/RELEASE-NOTES-1.23 +++ b/RELEASE-NOTES-1.23 @@ -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 diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 7f0454f6bf..b4fda1366d 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -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 -- 2.20.1