Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -66,6 +66,7 @@ |
67 | 67 | show the first bit of the new redirect page. |
68 | 68 | * (bug 5800) Added $formCallback as a parameter to the hook |
69 | 69 | EditPage::showEditForm:initial |
| 70 | +* (bug 29723) mw.util.wikiGetlink() now defaults to wgPageName. |
70 | 71 | |
71 | 72 | === Bug fixes in 1.19 === |
72 | 73 | * (bug 28868) Show total pages in the subtitle of an image on the |
Index: trunk/phase3/tests/qunit/suites/resources/mediawiki/mediawiki.util.js |
— | — | @@ -19,10 +19,11 @@ |
20 | 20 | }); |
21 | 21 | |
22 | 22 | test( 'wikiGetlink', function() { |
23 | | - expect(2); |
| 23 | + expect(3); |
24 | 24 | |
25 | 25 | // Not part of startUp module |
26 | 26 | mw.config.set( 'wgArticlePath', '/wiki/$1' ); |
| 27 | + mw.config.set( 'wgPageName', 'Foobar' ); |
27 | 28 | |
28 | 29 | var hrefA = mw.util.wikiGetlink( 'Sandbox' ); |
29 | 30 | equal( hrefA, '/wiki/Sandbox', 'Simple title; Get link for "Sandbox"' ); |
— | — | @@ -30,6 +31,9 @@ |
31 | 32 | var hrefB = mw.util.wikiGetlink( 'Foo:Sandbox ? 5+5=10 ! (test)/subpage' ); |
32 | 33 | equal( hrefB, '/wiki/Foo:Sandbox_%3F_5%2B5%3D10_%21_%28test%29/subpage', |
33 | 34 | 'Advanced title; Get link for "Foo:Sandbox ? 5+5=10 ! (test)/subpage"' ); |
| 35 | + |
| 36 | + var hrefC = mw.util.wikiGetlink(); |
| 37 | + equal( hrefC, '/wiki/Foobar', 'Default title; Get link for current page ("Foobar")' ); |
34 | 38 | }); |
35 | 39 | |
36 | 40 | test( 'wikiScript', function() { |
Index: trunk/phase3/resources/mediawiki/mediawiki.util.js |
— | — | @@ -139,8 +139,8 @@ |
140 | 140 | * @return string Location for a page with name of 'str' or boolean false on error. |
141 | 141 | */ |
142 | 142 | 'wikiGetlink' : function( str ) { |
143 | | - |
144 | | - return mw.config.get( 'wgArticlePath' ).replace( '$1', this.wikiUrlencode( str ) ); |
| 143 | + return mw.config.get( 'wgArticlePath' ).replace( '$1', |
| 144 | + this.wikiUrlencode( str || mw.config.get( 'wgPageName' ) ) ); |
145 | 145 | }, |
146 | 146 | |
147 | 147 | /** |