From d81a539362a6b1f1ad4a8f3b2e87166d05bc02a7 Mon Sep 17 00:00:00 2001 From: "Didier (did)" Date: Fri, 17 Sep 2021 06:24:17 +0000 Subject: [PATCH] [FIX] mail: add missing notifition when leaving a channel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will close the RTC session when a user leave a channel with a RTC session open. task-2646095 closes odoo/odoo#76849 X-original-commit: c5d2a17888d79e4b37cd8f9a690132b9cd556fbd Signed-off-by: Sébastien Theys (seb) --- addons/mail/models/mail_channel_partner.py | 2 +- addons/mail/static/src/models/thread/thread.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/mail/models/mail_channel_partner.py b/addons/mail/models/mail_channel_partner.py index 5860c704c59..e012f5ebb9e 100644 --- a/addons/mail/models/mail_channel_partner.py +++ b/addons/mail/models/mail_channel_partner.py @@ -66,7 +66,7 @@ class ChannelPartner(models.Model): return super(ChannelPartner, self).write(vals) def unlink(self): - self.sudo().rtc_session_ids.unlink() + self.sudo().rtc_session_ids._disconnect() return super().unlink() @api.model diff --git a/addons/mail/static/src/models/thread/thread.js b/addons/mail/static/src/models/thread/thread.js index f58e2c94b94..9d874019d1d 100644 --- a/addons/mail/static/src/models/thread/thread.js +++ b/addons/mail/static/src/models/thread/thread.js @@ -822,6 +822,9 @@ function factory(dependencies) { } } this.mailRtc && this.mailRtc.filterCallees(this.rtcSessions); + if (this.mailRtc && !this.mailRtc.currentRtcSession) { + this.endCall(); + } } /**