Target#tryTeardown should succeed when target isn't active

It makes other code easier to write when we want to make sure
that no target is active.

Change-Id: Ica75f8334ef32ffbcc59109a46624acdf271847d
This commit is contained in:
Bartosz Dziewoński 2023-02-07 00:03:07 +01:00
parent 8eb272c2be
commit 5736f8ead6

View file

@ -551,7 +551,7 @@ ve.init.mw.DesktopArticleTarget.prototype.teardownNewSection = function ( surfac
*/
ve.init.mw.DesktopArticleTarget.prototype.tryTeardown = function ( noPrompt, trackMechanism ) {
if ( this.deactivating || ( !this.active && !this.activating ) ) {
return this.teardownPromise || ve.createDeferred().reject().promise();
return this.teardownPromise || ve.createDeferred().resolve().promise();
}
// Just in case these weren't closed before