Fix NWE-only edit tab

Change-Id: I5d08e30f43fbe08eb8809692728a8ab37f3a1491
This commit is contained in:
Ed Sanders 2016-12-29 19:38:09 +00:00 committed by Esanders
parent 7de023caee
commit 9eebfbcac5
2 changed files with 20 additions and 23 deletions

View file

@ -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 {
@ -746,23 +746,6 @@
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.
init.isAvailable = (
@ -808,6 +791,23 @@
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 +1052,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 (

View file

@ -1318,10 +1318,7 @@ ve.init.mw.DesktopArticleTarget.prototype.updateHistoryState = function () {
// 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 {