jenkins-bot has submitted this change and it was merged.

Change subject: Don't change tabs on Education Program pages
......................................................................


Don't change tabs on Education Program pages

Unfortunately the best way I've come up with to do this so far is
checking the namespace.

Bug: 53477
Change-Id: Ib2dbe91aff516f2d2408e07ff3f73ea861bfcbe2
---
M VisualEditor.hooks.php
M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js
2 files changed, 12 insertions(+), 0 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php
index b5e75b0..e2bafab 100644
--- a/VisualEditor.hooks.php
+++ b/VisualEditor.hooks.php
@@ -68,6 +68,9 @@
                        return true;
                }
                $title = $skin->getRelevantTitle();
+               if ( defined( 'EP_NS' ) && $title->inNamespace( EP_NS ) ) {
+                       return true;
+               }
                // Rebuild the $links['views'] array and inject the 
VisualEditor tab before or after
                // the edit tab as appropriate. We have to rebuild the array 
because PHP doesn't allow
                // us to splice into the middle of an associative array.
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 08eadeb..663a7d5 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
@@ -155,6 +155,15 @@
                },
 
                setupTabs: function () {
+                       // HACK: Remove this when the Education Program offers 
a proper way to detect and disable.
+                       if (
+                               mw.config.get( 'wgNamespaceIds' 
).hasOwnProperty( 'education_program' ) &&
+                               /*jshint -W069*/
+                               mw.config.get( 'wgNamespaceIds' 
)['education_program'] === mw.config.get( 'wgNamespaceNumber' )
+                       ) {
+                               return;
+                       }
+
                        var caVeEdit,
                                action = pageExists ? 'edit' : 'create',
                                pTabsId = $( '#p-views' ).length ? 'p-views' : 
'p-cactions',

-- 
To view, visit https://gerrit.wikimedia.org/r/125233
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib2dbe91aff516f2d2408e07ff3f73ea861bfcbe2
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <kren...@gmail.com>
Gerrit-Reviewer: Catrope <roan.katt...@gmail.com>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to