jenkins-bot has submitted this change and it was merged.
Change subject: Fix flash of bad ve-edit tab on non-wikitext page in enabled
namespacea
......................................................................
Fix flash of bad ve-edit tab on non-wikitext page in enabled namespacea
E.g. when viewing User:Example/common.js there was previously
both Edit and Edit source (or Create and Create source) and the
client-side JavaScript then removed the ve-edit tab after checking
the content model for 've.isAvailable'.
Change-Id: Ic2daeefa439648ef0602f8606773655cf9ab188a
---
M VisualEditor.hooks.php
1 file changed, 8 insertions(+), 3 deletions(-)
Approvals:
Alex Monk: Looks good to me, approved
jenkins-bot: Verified
diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php
index 813ebc6..0481856 100644
--- a/VisualEditor.hooks.php
+++ b/VisualEditor.hooks.php
@@ -118,9 +118,14 @@
$availableNamespaces = $config->get(
'VisualEditorAvailableNamespaces' );
$title = $skin->getRelevantTitle();
- // Don't exit if this namespace isn't VE-enabled, since we
should still
- // change "Edit" to "Edit source" (especially for NS_MEDIAWIKI).
$namespaceEnabled = $title->inNamespaces( array_keys(
array_filter( $availableNamespaces ) ) );
+ $pageContentModel = $title->getContentModel();
+ // Don't exit if this page isn't VE-enabled, since we should
still
+ // change "Edit" to "Edit source".
+ $isAvailable = (
+ $namespaceEnabled &&
+ $pageContentModel === CONTENT_MODEL_WIKITEXT
+ );
// HACK: Exit if we're in the Education Program namespace (even
though it's content)
if ( defined( 'EP_NS' ) && $title->inNamespace( EP_NS ) ) {
@@ -168,7 +173,7 @@
if ( $editTabMessage !== null ) {
$editTab['text'] = $skin->msg(
$editTabMessage )->text();
}
- if ( $namespaceEnabled ) {
+ if ( $isAvailable ) {
// Inject the VE tab before or after
the edit tab
if ( $config->get(
'VisualEditorTabPosition' ) === 'before' ) {
$editTab['class'] .= '
collapsible';
--
To view, visit https://gerrit.wikimedia.org/r/233663
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic2daeefa439648ef0602f8606773655cf9ab188a
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits