From 9a37126ad283bd2738a3b8cb31bf37f8e0cac212 Mon Sep 17 00:00:00 2001 From: tsm-odoo Date: Wed, 20 Mar 2024 11:11:37 +0100 Subject: [PATCH] [FIX] mail: ptt extension race condition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .../static/src/discuss/call/common/ptt_extension_service.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/discuss/call/common/ptt_extension_service.js b/addons/mail/static/src/discuss/call/common/ptt_extension_service.js index b3c39c5aed2..b16799b436f 100644 --- a/addons/mail/static/src/discuss/call/common/ptt_extension_service.js +++ b/addons/mail/static/src/discuss/call/common/ptt_extension_service.js @@ -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) {