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
This commit is contained in:
Bartosz Dziewoński 2018-05-01 02:09:28 +02:00
parent 42fbb98374
commit 192a232410

View file

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