From 192a23241093dcf57e23957e4271bf233ca80977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Tue, 1 May 2018 02:09:28 +0200 Subject: [PATCH] ve.init.mw.DesktopArticleTarget.init: Edit the latest revision when viewing a FlaggedRevs-stable one When the user is viewing the last stable revision of a page which has newer unreviewed revisions, FlaggedRevs wants us to open the latest (unreviewed) revision of the page for editing. Use the JS config variable 'wgFlaggedRevsEditLatestRevision', provided by FlaggedRevs since change I4c9804fe2c4924e28770807881379ddca4fd8b76. Also add an extra comment about loading latest revisions in general. Bug: T165283 Depends-On: I4c9804fe2c4924e28770807881379ddca4fd8b76 Change-Id: Ic47491e690153d0ad87ce64bfc9e7a28a06fc6e2 --- .../init/targets/ve.init.mw.DesktopArticleTarget.init.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js index 3fe463f66c..ad1d4356f9 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js +++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js @@ -484,7 +484,10 @@ // T156998: Don't trust uri.query.oldid, it'll be wrong if uri.query.diff or uri.query.direction // is set to 'next' or 'prev'. oldId = mw.config.get( 'wgRevisionId' ) || $( 'input[name=parentRevId]' ).val(); - if ( oldId === mw.config.get( 'wgCurRevisionId' ) ) { + // wgFlaggedRevsEditLatestRevision is set by FlaggedRevs extension when viewing a stable revision + if ( oldId === mw.config.get( 'wgCurRevisionId' ) || 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; } pageExists = !!mw.config.get( 'wgRelevantArticleId' );