From d27825caa1744696cb19ef383975543fe822f769 Mon Sep 17 00:00:00 2001 From: Dringsim Date: Wed, 7 Jun 2023 20:58:08 +0800 Subject: [PATCH] Set a JS config var to force VisualEditor to edit the current version Rename wgFlaggedRevsEditLatestRevision to wgEditLatestRevision (not use 'VisualEditor' - this config may be used by other editors) Bug: T338312 Change-Id: I6c9c46774fe197ca7775b65f12e62bb3bcbe53b4 --- modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js | 2 +- modules/ve-mw/preinit/ve.init.mw.DesktopArticleTarget.init.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js b/modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js index 9d1ad4bf70..61d3470fc8 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js @@ -73,7 +73,7 @@ ve.init.mw.ArticleTarget = function VeInitMwArticleTarget( config ) { // Sometimes we actually don't want to send a useful oldid // if we do, PostEdit will give us a 'page restored' message // Use undefined instead of 0 for new documents (T262838) - this.requestedRevId = mw.config.get( 'wgRevisionId' ) || undefined; + this.requestedRevId = mw.config.get( 'wgEditLatestRevision' ) ? mw.config.get( 'wgCurRevisionId' ) : mw.config.get( 'wgRevisionId' ) || undefined; this.currentRevisionId = mw.config.get( 'wgCurRevisionId' ) || undefined; this.revid = this.requestedRevId || this.currentRevisionId; 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 ec16f98c3f..56312e86bf 100644 --- a/modules/ve-mw/preinit/ve.init.mw.DesktopArticleTarget.init.js +++ b/modules/ve-mw/preinit/ve.init.mw.DesktopArticleTarget.init.js @@ -761,8 +761,8 @@ // T156998: Don't trust 'oldid' query parameter, it'll be wrong if 'diff' or 'direction' // is set to 'next' or 'prev'. oldId = mw.config.get( 'wgRevisionId' ) || $( 'input[name=parentRevId]' ).val(); - // wgFlaggedRevsEditLatestRevision is set by FlaggedRevs extension when viewing a stable revision - if ( oldId === mw.config.get( 'wgCurRevisionId' ) || mw.config.get( 'wgFlaggedRevsEditLatestRevision' ) ) { + // TODO: remove wgFlaggedRevsEditLatestRevision + if ( oldId === mw.config.get( 'wgCurRevisionId' ) || mw.config.get( 'wgEditLatestRevision' ) || mw.config.get( 'wgFlaggedRevsEditLatestRevision' ) ) { // The page may have been edited by someone else after we loaded it, setting this to "undefined" // indicates that we should load the actual latest revision. oldId = undefined;