[FIX] auth_totp: fix the incomplete fix

The previous pass in #97567 missed a small window of race condition
in *closing the fecking dialog*. Apparently that's still not
instantaneous enough and it's possible to have the check trigger in
the interval between clicking the button and the dialog being
completely torn down.

Add an explicit test for this to the existing `closeProfileDialog`
utility function.

closes odoo/odoo#97969

Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
This commit is contained in:
Xavier Morel
2022-08-11 17:57:23 +02:00
parent 2e6b64cfab
commit 5c02342704
@@ -59,6 +59,17 @@ function closeProfileDialog({content, totp_state}) {
$modal.find('button[name=preference_cancel]').click()
}
}
}, {
trigger: 'body',
async run() {
while (document.querySelector('.o_dialog_container .o_dialog')) {
await Promise.resolve();
}
this.$anchor.addClass('dialog-closed');
},
}, {
trigger: 'body.dialog-closed',
run() {},
}];
}