| Index: trunk/phase3/includes/OutputPage.php |
| — | — | @@ -2840,6 +2840,10 @@ |
| 2841 | 2841 | $ns = $title->getNamespace(); |
| 2842 | 2842 | $nsname = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $title->getNsText(); |
| 2843 | 2843 | |
| | 2844 | + // Get the relevant title so that AJAX features can use the correct page name |
| | 2845 | + // when making API requests from certain special pages (bug 34972). |
| | 2846 | + $relevantTitle = $this->getSkin()->getRelevantTitle(); |
| | 2847 | + |
| 2844 | 2848 | if ( $ns == NS_SPECIAL ) { |
| 2845 | 2849 | list( $canonicalName, /*...*/ ) = SpecialPageFactory::resolveAlias( $title->getDBkey() ); |
| 2846 | 2850 | } elseif ( $this->canUseWikiPage() ) { |
| — | — | @@ -2881,6 +2885,7 @@ |
| 2882 | 2886 | 'wgPageContentLanguage' => $lang->getCode(), |
| 2883 | 2887 | 'wgSeparatorTransformTable' => $compactSeparatorTransTable, |
| 2884 | 2888 | 'wgDigitTransformTable' => $compactDigitTransTable, |
| | 2889 | + 'wgRelevantPageName' => $relevantTitle->getPrefixedDBKey(), |
| 2885 | 2890 | ); |
| 2886 | 2891 | if ( $wgContLang->hasVariants() ) { |
| 2887 | 2892 | $vars['wgUserVariant'] = $wgContLang->getPreferredVariant(); |
| Index: trunk/phase3/resources/mediawiki.action/mediawiki.action.watch.ajax.js |
| — | — | @@ -5,6 +5,11 @@ |
| 6 | 6 | ( function ( $, mw, undefined ) { |
| 7 | 7 | |
| 8 | 8 | /** |
| | 9 | + * The name of the page to watch or unwatch. |
| | 10 | + */ |
| | 11 | +var title = mw.config.get( 'wgRelevantPageName', mw.config.get( 'wgPageName' ) ); |
| | 12 | + |
| | 13 | +/** |
| 9 | 14 | * Update the link text, link href attribute and (if applicable) |
| 10 | 15 | * "loading" class. |
| 11 | 16 | * |
| — | — | @@ -24,7 +29,7 @@ |
| 25 | 30 | ( accesskeyTip ? ' ' + accesskeyTip[0] : '' ) |
| 26 | 31 | ) |
| 27 | 32 | .attr( 'href', mw.util.wikiScript() + '?' + $.param({ |
| 28 | | - title: mw.config.get( 'wgPageName' ), |
| | 33 | + title: title, |
| 29 | 34 | action: action |
| 30 | 35 | }) |
| 31 | 36 | ); |
| — | — | @@ -98,7 +103,7 @@ |
| 99 | 104 | |
| 100 | 105 | api = new mw.Api(); |
| 101 | 106 | api[action]( |
| 102 | | - mw.config.get( 'wgPageName' ), |
| | 107 | + title, |
| 103 | 108 | // Success |
| 104 | 109 | function( watchResponse ) { |
| 105 | 110 | var otherAction = action === 'watch' ? 'unwatch' : 'watch', |
| — | — | @@ -129,10 +134,10 @@ |
| 130 | 135 | updateWatchLink( $link, action ); |
| 131 | 136 | |
| 132 | 137 | // Format error message |
| 133 | | - var cleanTitle = mw.config.get( 'wgPageName' ).replace( /_/g, ' ' ); |
| | 138 | + var cleanTitle = title.replace( /_/g, ' ' ); |
| 134 | 139 | var link = mw.html.element( |
| 135 | 140 | 'a', { |
| 136 | | - 'href': mw.util.wikiGetlink( mw.config.get( 'wgPageName' ) ), |
| | 141 | + 'href': mw.util.wikiGetlink( title ), |
| 137 | 142 | 'title': cleanTitle |
| 138 | 143 | }, cleanTitle |
| 139 | 144 | ); |