From 2080f8fb18ffb4523487a85bbb31b25d977b428b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Mon, 4 Dec 2023 17:31:26 +0100 Subject: [PATCH] [FIX] mail: self-author on 'Creating a new record...' message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, when a record is in draft, the chatter message "Creating a new record..." shown no author. The intended showing is to display current user as author of this message. Persona model requires `id` and `type`, the latter to determine whether the persona is a guest or partner. Only the id of current user was provided, so it was not enough to determine the appropriate `Persona`. closes odoo/odoo#144864 Signed-off-by: Sébastien Theys (seb) --- addons/mail/static/src/core/web/thread_service_patch.js | 2 +- addons/mail/static/tests/web/chatter_tests.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/core/web/thread_service_patch.js b/addons/mail/static/src/core/web/thread_service_patch.js index fcd59ac561c..87ef909ed45 100644 --- a/addons/mail/static/src/core/web/thread_service_patch.js +++ b/addons/mail/static/src/core/web/thread_service_patch.js @@ -107,7 +107,7 @@ patch(ThreadService.prototype, { if (id === false) { thread.messages.push({ id: this.messageService.getNextTemporaryId(), - author: { id: this.store.self.id }, + author: this.store.self, body: _t("Creating a new record..."), message_type: "notification", trackingValues: [], diff --git a/addons/mail/static/tests/web/chatter_tests.js b/addons/mail/static/tests/web/chatter_tests.js index bd63318fb28..38f45123ee7 100644 --- a/addons/mail/static/tests/web/chatter_tests.js +++ b/addons/mail/static/tests/web/chatter_tests.js @@ -312,6 +312,7 @@ QUnit.test("base rendering when chatter has no record", async () => { await contains(".o-mail-AttachmentBox", { count: 0 }); await contains(".o-mail-Chatter .o-mail-Thread"); await contains(".o-mail-Message"); + await contains(".o-mail-Message-author", { text: "Mitchell Admin" }); await contains(".o-mail-Message-body", { text: "Creating a new record..." }); await contains("button", { count: 0, text: "Load More" }); await contains(".o-mail-Message-actions");