[FIX] mail: ptt extension race condition

The push-to-talk extension service sends a message to the extension
when starting to check if it is enabled. If the response is received
before the RTC service is started, the answer is ignored, and the
service acts as if the extension were not available. This PR fixes
this issue.

closes odoo/odoo#158252

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
tsm-odoo
2024-03-20 18:29:22 +00:00
parent a629230fec
commit 9a37126ad2
@@ -12,7 +12,10 @@ export const pttExtensionHookService = {
browser.addEventListener("message", ({ data }) => {
const rtc = env.services["discuss.rtc"];
if (data.from !== "discuss-push-to-talk" || !rtc) {
if (
data.from !== "discuss-push-to-talk" ||
(!rtc && data.type !== "answer-is-enabled")
) {
return;
}
switch (data.type) {