From 3cef4bd67a07d3501866ca25e5eb9809e4a6f729 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Mon, 2 Apr 2007 06:27:55 +0000 Subject: [PATCH] (bug 4764) "My contributions" not bold when viewing own contributions --- RELEASE-NOTES | 1 + includes/SkinTemplate.php | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ab8df3888a..76ae6bedc9 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -297,6 +297,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 9466) "Rollback failed" page doesn't format edit comment * (bug 9472) Invalid XHTML on cached special pages * (bug 9472) Invalid XHTML on Special:Newpages +* (bug 4764) "My contributions" not bold when viewing own contributions == Maintenance == * New script maintenance/language/checkExtensioni18n.php used to check i18n diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index 9643b1736e..8f34935fb8 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -488,7 +488,7 @@ class SkinTemplate extends Skin { * @private */ function buildPersonalUrls() { - global $wgTitle; + global $wgTitle, $wgRequest; $fname = 'SkinTemplate::buildPersonalUrls'; $pageurl = $wgTitle->getLocalURL(); @@ -522,13 +522,28 @@ class SkinTemplate extends Skin { 'href' => $href, 'active' => ( $href == $pageurl ) ); + + # We need to do an explicit check for Special:Contributions, as we + # have to match both the title, and the target (which could come + # from request values or be specified in "sub page" form. The plot + # thickens, because $wgTitle is altered for special pages, so doesn't + # contain the original alias-with-subpage. + $title = Title::newFromText( $wgRequest->getText( 'title' ) ); + if( $title instanceof Title && $title->getNamespace() == NS_SPECIAL ) { + list( $spName, $spPar ) = + SpecialPage::resolveAliasWithSubpage( $title->getText() ); + $active = $spName == 'Contributions' + && ( ( $spPar && $spPar == $this->username ) + || $wgRequest->getText( 'target' ) == $this->username ); + } else { + $active = false; + } + $href = self::makeSpecialUrlSubpage( 'Contributions', $this->username ); $personal_urls['mycontris'] = array( 'text' => wfMsg( 'mycontris' ), 'href' => $href, - // FIXME # 'active' was disabled in r11346 with message: "disable bold link to my contributions; link was bold on all - // Special:Contributions, not just current user's (fix me please!)". Until resolved (bug 4764), explicitly setting active to false. - 'active' => false # ( ( $href == $pageurl . '/' . $this->username ) + 'active' => $active ); $personal_urls['logout'] = array( 'text' => wfMsg( 'userlogout' ), -- 2.20.1