Esanders has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/329634 )

Change subject: Fix NWE-only edit tab
......................................................................

Fix NWE-only edit tab

Change-Id: I5d08e30f43fbe08eb8809692728a8ab37f3a1491
---
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
2 files changed, 21 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/34/329634/1

diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js 
b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
index 8324fb2..373c566 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
@@ -733,7 +733,7 @@
 
        // On a view page, extend the current URI so parameters like oldid are 
carried over
        // On a non-view page, use viewUri
-       if ( isOnlyTabVE() ) {
+       if ( init.isSingleEditTab ) {
                veEditUri = viewUri.clone().extend( { action: 'edit' } );
                delete veEditUri.query.veaction;
        } else {
@@ -745,23 +745,6 @@
        if ( oldid ) {
                veEditUri.extend( { oldid: oldid } );
        }
-
-       userPrefEnabled = (
-               // Allow disabling for anonymous users separately from changing 
the
-               // default preference (bug 50000)
-               !( conf.disableForAnons && mw.config.get( 'wgUserName' ) === 
null ) &&
-
-               // User has 'visualeditor-enable' preference enabled (for alpha 
opt-in)
-               // User has 'visualeditor-betatempdisable' preference disabled
-               // User has 'visualeditor-autodisable' preference disabled
-               enable && !tempdisable && !autodisable
-       );
-       userPrefPreferShow = (
-               userPrefEnabled &&
-
-               // If in two-edit-tab mode, or the user doesn't prefer wikitext 
always
-               ( !conf.singleEditTab || tabPreference !== 'prefer-wt' )
-       );
 
        // Whether VisualEditor should be available for the current user, page, 
wiki, mediawiki skin,
        // browser etc.
@@ -807,6 +790,24 @@
        if ( init.isWikitextAvailable ) {
                editModes.editsource = 'source';
        }
+
+       userPrefEnabled = (
+               // Allow disabling for anonymous users separately from changing 
the
+               // default preference (bug 50000)
+               !( conf.disableForAnons && mw.config.get( 'wgUserName' ) === 
null ) &&
+
+               // User has 'visualeditor-enable' preference enabled (for alpha 
opt-in)
+               // User has 'visualeditor-betatempdisable' preference disabled
+               // User has 'visualeditor-autodisable' preference disabled
+               enable && !tempdisable && !autodisable
+       );
+       userPrefPreferShow = (
+               userPrefEnabled &&
+
+               // Except when single edit tab for old wikitext
+               !( conf.singleEditTab && tabPreference === 'prefer-wt' && 
!init.isWikitextAvailable )
+       );
+
 
        // FIXME: We should do this more elegantly
        init.setEditorPreference = setEditorPreference;
@@ -1052,7 +1053,7 @@
                        // Set up the tabs appropriately if the user has VE on
                        if ( init.isAvailable && userPrefPreferShow ) {
                                // … on two-edit-tab wikis, or single-edit-tab 
wikis, where the user wants both …
-                               if ( !conf.singleEditTab || tabPreference === 
'multi-tab' ) {
+                               if ( !init.isSingleEditTab ) {
                                        // … set the skin up with both tabs and 
both section edit links.
                                        init.setupMultiTabSkin();
                                } else if (
diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js 
b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
index b88f920..77d9ed6 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
@@ -1318,10 +1318,7 @@
                // Set the current URL
                uri = this.currentUri;
 
-               if (
-                       mw.config.get( 'wgVisualEditorConfig' ).singleEditTab &&
-                       mw.user.options.get( 'visualeditor-tabs' ) !== 
'multi-tab'
-               ) {
+               if ( mw.libs.ve.isSingleEditTab ) {
                        uri.query.action = 'edit';
                        mw.config.set( 'wgAction', 'edit' );
                } else {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5d08e30f43fbe08eb8809692728a8ab37f3a1491
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <esand...@wikimedia.org>

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

Reply via email to