mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-23 16:06:53 +00:00
Reattempt the save when something already created a temporary account
Bug: T368263 Change-Id: I2adcb83017daff578627aa02b04934be21eade44
This commit is contained in:
parent
5bb03b9e7f
commit
4ff5bf253d
|
@ -586,6 +586,25 @@ CommentController.prototype.save = function ( pageName, extraParams ) {
|
|||
return mw.libs.ve.targetSaver.postContent(
|
||||
data, { api: noTimeoutApi }
|
||||
).catch( ( code, responseData ) => {
|
||||
if ( code === 'assertanonfailed' ) {
|
||||
// Reattempt the save when something already created a temporary account (T368263)
|
||||
return controller.getApi().get( {
|
||||
meta: 'userinfo'
|
||||
} ).then( ( resp ) => {
|
||||
if ( !resp.query.userinfo.temp ) {
|
||||
// Return the original error response
|
||||
return $.Deferred().reject( code, responseData ).promise();
|
||||
}
|
||||
// Set new parameters and retry
|
||||
data.assert = 'user';
|
||||
data.assertuser = resp.query.userinfo.name;
|
||||
return mw.libs.ve.targetSaver.postContent(
|
||||
data, { api: noTimeoutApi }
|
||||
);
|
||||
} );
|
||||
}
|
||||
return $.Deferred().reject( code, responseData ).promise();
|
||||
} ).catch( ( code, responseData ) => {
|
||||
// Better user-facing error messages
|
||||
if ( code === 'editconflict' ) {
|
||||
return $.Deferred().reject( code, { errors: [ {
|
||||
|
|
Loading…
Reference in a new issue