mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-12 01:16:19 +00:00
CommentController: Fix 'discussiontoolscompare' polling not stopping
The .always() callback can be called after .teardown(), and would previously restart the polling. Bug: T313096 Change-Id: I6e4c0f7d47e13bd4a259282a508afcdf0c1bd949
This commit is contained in:
parent
51ed8a21f6
commit
7dc35aa3ad
|
@ -49,6 +49,7 @@ function CommentController( $pageContainer, threadItem, threadItemSet ) {
|
|||
// Mixin constructors
|
||||
OO.EventEmitter.call( this );
|
||||
|
||||
this.isTornDown = false;
|
||||
this.$pageContainer = $pageContainer;
|
||||
this.threadItem = threadItem;
|
||||
this.threadItemSet = threadItemSet;
|
||||
|
@ -280,6 +281,9 @@ CommentController.prototype.startPoll = function () {
|
|||
|
||||
commentController.oldId = result.torevid;
|
||||
} ).always( function () {
|
||||
if ( commentController.isTornDown ) {
|
||||
return;
|
||||
}
|
||||
commentController.pollTimeout = setTimeout( commentController.startPoll.bind( commentController ), 5000 );
|
||||
} );
|
||||
};
|
||||
|
@ -375,6 +379,7 @@ CommentController.prototype.teardown = function ( mode ) {
|
|||
this.stopPoll();
|
||||
$( document ).off( 'visibilitychange', this.onVisibilityChangeHandler );
|
||||
|
||||
this.isTornDown = true;
|
||||
this.emit( 'teardown', mode );
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue