mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 00:13:36 +00:00
Merge "Pause polling for new replies while saving"
This commit is contained in:
commit
30897f824d
|
@ -232,6 +232,7 @@ CommentController.prototype.startPoll = function ( nextDelay ) {
|
||||||
|
|
||||||
const threadItemId = this.threadItem.id;
|
const threadItemId = this.threadItem.id;
|
||||||
const subscribableHeadingId = this.threadItem.getSubscribableHeading().id;
|
const subscribableHeadingId = this.threadItem.getSubscribableHeading().id;
|
||||||
|
let aborted = false;
|
||||||
|
|
||||||
this.pollApiRequest = controller.getApi().get( {
|
this.pollApiRequest = controller.getApi().get( {
|
||||||
action: 'discussiontoolscompare',
|
action: 'discussiontoolscompare',
|
||||||
|
@ -266,11 +267,15 @@ CommentController.prototype.startPoll = function ( nextDelay ) {
|
||||||
|
|
||||||
this.oldId = result.torevid;
|
this.oldId = result.torevid;
|
||||||
nextDelay = 5000;
|
nextDelay = 5000;
|
||||||
}, () => {
|
}, ( code, data ) => {
|
||||||
// Wait longer next time in case of error
|
if ( code === 'http' && data.textStatus === 'abort' ) {
|
||||||
nextDelay = nextDelay * 1.5;
|
aborted = true;
|
||||||
|
} else {
|
||||||
|
// Wait longer next time in case of error
|
||||||
|
nextDelay = nextDelay * 1.5;
|
||||||
|
}
|
||||||
} ).always( () => {
|
} ).always( () => {
|
||||||
if ( this.isTornDown ) {
|
if ( this.isTornDown || aborted ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Stop polling after too many errors
|
// Stop polling after too many errors
|
||||||
|
@ -498,6 +503,8 @@ CommentController.prototype.onReplySubmit = function ( extraParams ) {
|
||||||
* @param {Object} data Error data
|
* @param {Object} data Error data
|
||||||
*/
|
*/
|
||||||
CommentController.prototype.saveFail = function ( code, data ) {
|
CommentController.prototype.saveFail = function ( code, data ) {
|
||||||
|
this.startPoll();
|
||||||
|
|
||||||
const captchaData = OO.getProp( data, 'discussiontoolsedit', 'edit', 'captcha' );
|
const captchaData = OO.getProp( data, 'discussiontoolsedit', 'edit', 'captcha' );
|
||||||
|
|
||||||
if ( captchaData ) {
|
if ( captchaData ) {
|
||||||
|
@ -550,6 +557,8 @@ CommentController.prototype.saveFail = function ( code, data ) {
|
||||||
* @return {jQuery.Promise} Promise which resolves when the save is complete
|
* @return {jQuery.Promise} Promise which resolves when the save is complete
|
||||||
*/
|
*/
|
||||||
CommentController.prototype.save = function ( pageName, extraParams ) {
|
CommentController.prototype.save = function ( pageName, extraParams ) {
|
||||||
|
this.stopPoll();
|
||||||
|
|
||||||
const replyWidget = this.replyWidget,
|
const replyWidget = this.replyWidget,
|
||||||
threadItem = this.getThreadItem();
|
threadItem = this.getThreadItem();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue