From c93d4a9695717864691e8cc0fdd692d04c3561a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Mon, 26 Aug 2024 19:55:55 +0200 Subject: [PATCH] Allow &veaction=editsource to load 2017WTE regardless of user prefs Bug: T239796 Change-Id: I0391d44d15763980cfb48b2945bac35e5b08e930 --- .../ve-mw/preinit/ve.init.mw.ArticleTargetLoader.js | 8 ++------ .../preinit/ve.init.mw.DesktopArticleTarget.init.js | 11 +++++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/modules/ve-mw/preinit/ve.init.mw.ArticleTargetLoader.js b/modules/ve-mw/preinit/ve.init.mw.ArticleTargetLoader.js index cbc74923f8..5d9b650ce3 100644 --- a/modules/ve-mw/preinit/ve.init.mw.ArticleTargetLoader.js +++ b/modules/ve-mw/preinit/ve.init.mw.ArticleTargetLoader.js @@ -30,12 +30,8 @@ const url = new URL( location.href ); // Provide the new wikitext editor if ( - conf.enableWikitext && - ( - mw.user.options.get( 'visualeditor-newwikitext' ) || - url.searchParams.get( 'veaction' ) === 'editsource' - ) && - mw.loader.getState( 'ext.visualEditor.mwwikitext' ) + mw.user.options.get( 'visualeditor-newwikitext' ) || + url.searchParams.get( 'veaction' ) === 'editsource' ) { modules.push( 'ext.visualEditor.mwwikitext' ); } diff --git a/modules/ve-mw/preinit/ve.init.mw.DesktopArticleTarget.init.js b/modules/ve-mw/preinit/ve.init.mw.DesktopArticleTarget.init.js index c7b1674893..106029cbae 100644 --- a/modules/ve-mw/preinit/ve.init.mw.DesktopArticleTarget.init.js +++ b/modules/ve-mw/preinit/ve.init.mw.DesktopArticleTarget.init.js @@ -1351,11 +1351,14 @@ init.isWikitextAvailable = ( init.isAvailable && - // Enabled on site - conf.enableWikitext && + // If forced by the URL parameter, skip the checks (T239796) + ( url.searchParams.get( 'veaction' ) === 'editsource' || ( + // Enabled on site + conf.enableWikitext && - // User preference - mw.user.options.get( 'visualeditor-newwikitext' ) && + // User preference + mw.user.options.get( 'visualeditor-newwikitext' ) + ) ) && // Only on wikitext pages mw.config.get( 'wgPageContentModel' ) === 'wikitext'