Esanders has uploaded a new change for review.
https://gerrit.wikimedia.org/r/77246
Change subject: Fix edit links on special pages
......................................................................
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
---
M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js
1 file changed, 4 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/46/77246/1
diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js
b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js
index 0b7af16..eafd735 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js
@@ -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 )
);
--
To view, visit https://gerrit.wikimedia.org/r/77246
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib47e5524d41e6066b362e0f5645750c769de5193
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits