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
This commit is contained in:
Dringsim 2023-06-07 20:58:08 +08:00 committed by 沈澄心
parent ed3f643642
commit d27825caa1
2 changed files with 3 additions and 3 deletions

View file

@ -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;

View file

@ -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;