diff --git a/addons/im_livechat/static/src/core/web/thread_model_patch.js b/addons/im_livechat/static/src/core/web/thread_model_patch.js index 96baeca8e86..55028d97453 100644 --- a/addons/im_livechat/static/src/core/web/thread_model_patch.js +++ b/addons/im_livechat/static/src/core/web/thread_model_patch.js @@ -25,8 +25,8 @@ patch(Thread.prototype, { return super.correspondents.filter((correspondent) => !correspondent.is_bot); }, - get correspondent() { - let correspondent = super.correspondent; + computeCorrespondent() { + let correspondent = super.computeCorrespondent(); if (this.type === "livechat" && !correspondent) { // For livechat threads, the correspondent is the first // channel member that is not the operator. diff --git a/addons/mail/static/src/core/common/thread_model.js b/addons/mail/static/src/core/common/thread_model.js index 633983cb580..f9e46e2cce0 100644 --- a/addons/mail/static/src/core/common/thread_model.js +++ b/addons/mail/static/src/core/common/thread_model.js @@ -186,6 +186,11 @@ export class Thread extends Record { invitedMembers = Record.many("ChannelMember"); chatPartner = Record.one("Persona"); composer = Record.one("Composer", { inverse: "thread", onDelete: (r) => r.delete() }); + correspondent2 = Record.one("Persona", { + compute() { + return this.computeCorrespondent(); + }, + }); counter = 0; /** @type {string} */ custom_channel_name; @@ -360,8 +365,11 @@ export class Thread extends Record { .filter((p) => p.notEq(this._store.self)); } - /** @type {import("models").Persona|undefined} */ get correspondent() { + return this.correspondent2; + } + + computeCorrespondent() { if (this.type === "channel") { return undefined; }