[FIX] mail: prevent unnecessary re instantiation of the callViewer model

Before this commit, the callViewer model was re instantiated in cases
when the amount of RTC session would change, which was not necessary
if the call viewer was already present.

This could cause tracebacks accessing deleted callViewers.

closes odoo/odoo#76328

X-original-commit: d2c9cc55bbabd21cbbbc8a0e77f6935fdafddeea
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
Thanh Dodeur
2021-09-10 12:34:13 +00:00
parent bd41225e46
commit fdd09b60c7
@@ -72,6 +72,9 @@ function factory(dependencies) {
*/
_computeRtcCallViewer() {
if (this.thread && this.thread.model === 'mail.channel' && this.thread.rtcSessions.length > 0) {
if (this.rtcCallViewer) {
return;
}
return create();
}
return unlink();