Fix edit links on special pages

Added wgIsArticle to isViewPage checks, otherwise we were attempting
to load VE dynamically on Special:Move/Delete, which resulted in a
broken h1 title and odd behavior off the 'Read' tab.

Also added !wgIsArticle to pageExists. This is a bit of a hack because
we don't have any info on page existence in the JS on these pages
(I think?). But it's better to display 'Edit' for a page that doesn't
exist, than 'Create' for a page that does.

Bug: 49000
Change-Id: Ib47e5524d41e6066b362e0f5645750c769de5193
This commit is contained in:
Ed Sanders 2013-08-01 23:14:51 +01:00
parent 9f7692a1eb
commit 1984c3ca46

View file

@ -53,11 +53,14 @@
conf = mw.config.get( 'wgVisualEditorConfig' );
uri = new mw.Uri();
pageExists = !!mw.config.get( 'wgArticleId' );
// For non-article pages, no information about page existence is exposed to
// mw.config, so we assume it exists TODO: fix this in core.
pageExists = !!mw.config.get( 'wgArticleId' ) || !mw.config.get( 'wgIsArticle' );
viewUri = new mw.Uri( mw.util.wikiGetlink( mw.config.get( 'wgRelevantPageName' ) ) );
veEditUri = viewUri.clone().extend( { 'veaction': 'edit' } );
isViewPage = (
mw.config.get( 'wgAction' ) === 'view' &&
mw.config.get( 'wgIsArticle' ) &&
!( 'diff' in uri.query )
);