https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113737
Revision: 113737
Author: rmoen
Date: 2012-03-13 17:57:54 +0000 (Tue, 13 Mar 2012)
Log Message:
-----------
User:PleaseStand patch fixes bug 34972
Modified Paths:
--------------
trunk/phase3/includes/OutputPage.php
trunk/phase3/resources/mediawiki.action/mediawiki.action.watch.ajax.js
Modified: trunk/phase3/includes/OutputPage.php
===================================================================
--- trunk/phase3/includes/OutputPage.php 2012-03-13 17:51:48 UTC (rev
113736)
+++ trunk/phase3/includes/OutputPage.php 2012-03-13 17:57:54 UTC (rev
113737)
@@ -2840,6 +2840,10 @@
$ns = $title->getNamespace();
$nsname = MWNamespace::exists( $ns ) ?
MWNamespace::getCanonicalName( $ns ) : $title->getNsText();
+ // 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();
+
if ( $ns == NS_SPECIAL ) {
list( $canonicalName, /*...*/ ) =
SpecialPageFactory::resolveAlias( $title->getDBkey() );
} elseif ( $this->canUseWikiPage() ) {
@@ -2881,6 +2885,7 @@
'wgPageContentLanguage' => $lang->getCode(),
'wgSeparatorTransformTable' =>
$compactSeparatorTransTable,
'wgDigitTransformTable' => $compactDigitTransTable,
+ 'wgRelevantPageName' =>
$relevantTitle->getPrefixedDBKey(),
);
if ( $wgContLang->hasVariants() ) {
$vars['wgUserVariant'] =
$wgContLang->getPreferredVariant();
Modified: trunk/phase3/resources/mediawiki.action/mediawiki.action.watch.ajax.js
===================================================================
--- trunk/phase3/resources/mediawiki.action/mediawiki.action.watch.ajax.js
2012-03-13 17:51:48 UTC (rev 113736)
+++ trunk/phase3/resources/mediawiki.action/mediawiki.action.watch.ajax.js
2012-03-13 17:57:54 UTC (rev 113737)
@@ -5,6 +5,11 @@
( function ( $, mw, undefined ) {
/**
+ * The name of the page to watch or unwatch.
+ */
+var title = mw.config.get( 'wgRelevantPageName', mw.config.get( 'wgPageName' )
);
+
+/**
* Update the link text, link href attribute and (if applicable)
* "loading" class.
*
@@ -24,7 +29,7 @@
( accesskeyTip ? ' ' + accesskeyTip[0] : '' )
)
.attr( 'href', mw.util.wikiScript() + '?' + $.param({
- title: mw.config.get( 'wgPageName' ),
+ title: title,
action: action
})
);
@@ -98,7 +103,7 @@
api = new mw.Api();
api[action](
- mw.config.get( 'wgPageName' ),
+ title,
// Success
function( watchResponse ) {
var otherAction = action === 'watch' ?
'unwatch' : 'watch',
@@ -129,10 +134,10 @@
updateWatchLink( $link, action );
// Format error message
- var cleanTitle = mw.config.get( 'wgPageName'
).replace( /_/g, ' ' );
+ var cleanTitle = title.replace( /_/g, ' ' );
var link = mw.html.element(
'a', {
- 'href': mw.util.wikiGetlink(
mw.config.get( 'wgPageName' ) ),
+ 'href': mw.util.wikiGetlink(
title ),
'title': cleanTitle
}, cleanTitle
);
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs