mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
Also check for revid conflict when RESTBase says page doesn't exist
There used to be similar code here, but it was removed in 2015 in
85b745666f
because it wasn't correct in
some cases. Restore it and instead separately check for those cases.
Bug: T257124
Change-Id: Id4a17266111d064805aa0ca865182bb2f4b019eb
This commit is contained in:
parent
ed2cfe8fd2
commit
36bd09c429
|
@ -434,6 +434,8 @@ ve.init.mw.ArticleTarget.prototype.parseMetadata = function ( response ) {
|
|||
|
||||
this.canEdit = data.canEdit;
|
||||
|
||||
// Zero indicates that the page doesn't exist
|
||||
docRevId = 0;
|
||||
aboutDoc = this.doc.documentElement && this.doc.documentElement.getAttribute( 'about' );
|
||||
if ( aboutDoc ) {
|
||||
docRevIdMatches = aboutDoc.match( /revision\/([0-9]*)$/ );
|
||||
|
@ -441,7 +443,9 @@ ve.init.mw.ArticleTarget.prototype.parseMetadata = function ( response ) {
|
|||
docRevId = parseInt( docRevIdMatches[ 1 ] );
|
||||
}
|
||||
}
|
||||
if ( docRevId && docRevId !== this.revid ) {
|
||||
// There is no docRevId in source mode (doc is just a string).
|
||||
// After switching with changes, the doc isn't associated with any particular revid.
|
||||
if ( this.getDefaultMode() === 'visual' && !( this.switched && this.fromEditedState ) && docRevId !== this.revid ) {
|
||||
if ( this.retriedRevIdConflict ) {
|
||||
// Retried already, just error the second time.
|
||||
this.loadFail( 've-api', { errors: [ {
|
||||
|
|
Loading…
Reference in a new issue