Jforrester has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/97701


Change subject: Make veaction=edit work regardless of user preference
......................................................................

Make veaction=edit work regardless of user preference

Move the userPrefEnabled check out of isAvailable and instead check
it in-line with isAvailable for setting up the tabs with CSS, but
not for the veaction=edit function.

Bug: 55900
Change-Id: I23984e377ff3fc797e921546492b8c73a5101235
---
M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.init.js
1 file changed, 7 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/01/97701/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 847e839..d340019 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
@@ -356,8 +356,6 @@
        init.isAvailable = (
                support.visualEditor &&
 
-               userPrefEnabled &&
-
                // Disable on redirect pages until redirects are editable (bug 
47328)
                // Property wgIsRedirect is relatively new in core, many cached 
pages
                // don't have it yet. We do a best-effort approach using the 
url query
@@ -391,7 +389,7 @@
        // on this page. See above for why it may be false.
        mw.libs.ve = init;
 
-       if ( init.isAvailable ) {
+       if ( init.isAvailable && userPrefEnabled ) {
                $( 'html' ).addClass( 've-available' );
        } else {
                $( 'html' ).addClass( 've-not-available' );
@@ -399,22 +397,17 @@
                // for e.g. "Edit" > "Edit source" even when VE is not 
available.
        }
 
-       if ( !userPrefEnabled ) {
-               // However if ve is not available because of user preferences 
(as opposed
-               // to because of the page, namespace, browser etc.) then we do 
want to
-               // return early as in that case even transformation of edit 
source should
-               // not be done.
-               return;
-       }
-
        $( function () {
-               if ( init.isAvailable && isViewPage ) {
-                       if ( uri.query.veaction === 'edit' ) {
+               if ( init.isAvailable ) {
+                       if ( isViewPage && uri.query.veaction === 'edit' ) {
                                getTarget().done( function ( target ) {
                                        target.activate();
                                } );
                        }
                }
-               init.setupSkin();
+
+               if ( userPrefEnabled ) {
+                       init.setupSkin();
+               }
        } );
 }() );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I23984e377ff3fc797e921546492b8c73a5101235
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Jforrester <jforres...@wikimedia.org>

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

Reply via email to