mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-01 01:16:30 +00:00
Merge "ArticleTargetSaver: Fix handling for data.result !== 'success'
"
This commit is contained in:
commit
924e579c19
|
@ -1545,11 +1545,14 @@ ve.init.mw.ArticleTarget.prototype.getWikitextDiffPromise = function ( doc ) {
|
|||
oldid: this.revid,
|
||||
etag: this.etag
|
||||
}, 'diff' ).then( function ( data ) {
|
||||
if ( data.result === 'nochanges' ) {
|
||||
return data.diff;
|
||||
}, function ( code, response ) {
|
||||
// ArticleTargetSaver treats this as an error, this is silly
|
||||
if ( response.visualeditoredit && response.visualeditoredit.result === 'nochanges' ) {
|
||||
target.emit( 'noChanges' );
|
||||
return null;
|
||||
}
|
||||
return data.diff;
|
||||
return ve.createDeferred().reject( code, response ).promise();
|
||||
} );
|
||||
this.wikitextDiffPromise
|
||||
.done( this.emit.bind( this, 'showChanges' ) )
|
||||
|
|
|
@ -256,11 +256,11 @@
|
|||
html: 'Invalid response from server'
|
||||
};
|
||||
} else if ( data.result !== 'success' ) {
|
||||
// Note, this could be any of db failure, hookabort, badtoken or even a captcha
|
||||
error = {
|
||||
code: 'failure',
|
||||
html: 'Save failure: ' + mw.html.escape( data.result )
|
||||
};
|
||||
// This can only happen when:
|
||||
// * viewing a diff with no changes (`data.result === 'nochanges'`)
|
||||
// * saving an edit and getting a captcha (`data.result === 'error'`)
|
||||
// It's a silly special case...
|
||||
return $.Deferred().reject( 'no-error-no-success', response ).promise();
|
||||
} else {
|
||||
// paction specific errors
|
||||
switch ( data.paction ) {
|
||||
|
|
Loading…
Reference in a new issue