From a8d7887f347dc281ee3cc79ba21386329df83ff1 Mon Sep 17 00:00:00 2001 From: Thanh Dodeur Date: Wed, 31 Aug 2022 06:53:53 +0000 Subject: [PATCH] [FIX] mail: prevents shared rtcSession focus across callViews MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After https://github.com/odoo/odoo/pull/78439 and before this commit, the `activeRtcSession` was a field of `callView` which is the same view for all channels. Which means that setting an `activeRtcSession` would display it for any channel instead of only the channel that hosted this session. This commit fixes this issue by moving the field to the `Channel` model. closes odoo/odoo#99270 Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/models/call_participant_card.js | 4 ++-- addons/mail/static/src/models/call_settings_menu.js | 2 +- addons/mail/static/src/models/call_view.js | 4 +++- addons/mail/static/src/models/channel.js | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/mail/static/src/models/call_participant_card.js b/addons/mail/static/src/models/call_participant_card.js index cd168b942be..06456140d4a 100644 --- a/addons/mail/static/src/models/call_participant_card.js +++ b/addons/mail/static/src/models/call_participant_card.js @@ -26,9 +26,9 @@ registerModel({ } if (this.rtcSession) { if (this.callView.activeRtcSession === this.rtcSession && this.mainViewTileOwner) { - this.callView.update({ activeRtcSession: clear() }); + this.callView.channel.update({ activeRtcSession: clear() }); } else { - this.callView.update({ activeRtcSession: this.rtcSession }); + this.callView.channel.update({ activeRtcSession: this.rtcSession }); } return; } diff --git a/addons/mail/static/src/models/call_settings_menu.js b/addons/mail/static/src/models/call_settings_menu.js index 146fe2a0321..0adca6d1761 100644 --- a/addons/mail/static/src/models/call_settings_menu.js +++ b/addons/mail/static/src/models/call_settings_menu.js @@ -57,7 +57,7 @@ registerModel({ } const activeRtcSession = this.callView.activeRtcSession; if (showOnlyVideo && activeRtcSession && !activeRtcSession.videoStream) { - this.callView.update({ activeRtcSession: clear() }); + this.callView.channel.update({ activeRtcSession: clear() }); } }, onClickRegisterKeyButton() { diff --git a/addons/mail/static/src/models/call_view.js b/addons/mail/static/src/models/call_view.js index 6dc2e2537b0..4a05d7c2a3a 100644 --- a/addons/mail/static/src/models/call_view.js +++ b/addons/mail/static/src/models/call_view.js @@ -158,7 +158,9 @@ registerModel({ /** * The rtc session that is the main card of the view. */ - activeRtcSession: one('RtcSession'), + activeRtcSession: one('RtcSession', { + related: 'channel.activeRtcSession', + }), /** * The aspect ratio of the tiles. */ diff --git a/addons/mail/static/src/models/channel.js b/addons/mail/static/src/models/channel.js index 6a3b80aadf5..3c407c7a0c8 100644 --- a/addons/mail/static/src/models/channel.js +++ b/addons/mail/static/src/models/channel.js @@ -192,6 +192,7 @@ registerModel({ }, }, fields: { + activeRtcSession: one('RtcSession'), areAllMembersLoaded: attr({ compute: '_computeAreAllMembersLoaded', }),