From 3e00a3f6331fcec6dea3e74c99d3bcb71ae4d637 Mon Sep 17 00:00:00 2001 From: "Didier (did)" Date: Wed, 13 Dec 2023 13:01:39 +0000 Subject: [PATCH] [FIX] mail: add "To: No recipient" when there is no followers task-3611153 closes odoo/odoo#148570 X-original-commit: 5f4f89a3573736c70c96e82d4cd12423a94ebb2e Signed-off-by: Didier Debondt (did) --- addons/mail/i18n/mail.pot | 7 +++++++ addons/mail/static/src/core/web/chatter.js | 3 +++ addons/mail/static/src/core/web/chatter.xml | 4 ++-- addons/mail/static/tests/composer/composer_tests.js | 9 +++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/addons/mail/i18n/mail.pot b/addons/mail/i18n/mail.pot index 6350cff2cdf..becaa604898 100644 --- a/addons/mail/i18n/mail.pot +++ b/addons/mail/i18n/mail.pot @@ -11048,3 +11048,10 @@ msgstr "" #, python-format msgid "“%(member_name)s” in “%(channel_name)s”" msgstr "" + +#. module: mail +#. odoo-javascript +#: code:addons/mail/static/src/core/web/chatter.js:0 +#, python-format +msgid "No recipient" +msgstr "" diff --git a/addons/mail/static/src/core/web/chatter.js b/addons/mail/static/src/core/web/chatter.js index acc43b883e8..7e2f008bb3e 100644 --- a/addons/mail/static/src/core/web/chatter.js +++ b/addons/mail/static/src/core/web/chatter.js @@ -225,6 +225,9 @@ export class Chatter extends Component { * @returns {string} */ get toRecipientsText() { + if (this.state.thread?.recipients.length === 0) { + return _t("No recipient"); + } const recipients = [...(this.state.thread?.recipients ?? [])] .slice(0, 5) .map(({ partner }) => { diff --git a/addons/mail/static/src/core/web/chatter.xml b/addons/mail/static/src/core/web/chatter.xml index 593ac51d9e2..66c8180fee1 100644 --- a/addons/mail/static/src/core/web/chatter.xml +++ b/addons/mail/static/src/core/web/chatter.xml @@ -72,10 +72,10 @@ - +
To: -
diff --git a/addons/mail/static/tests/composer/composer_tests.js b/addons/mail/static/tests/composer/composer_tests.js index 91bb7e3fca6..0172e710da7 100644 --- a/addons/mail/static/tests/composer/composer_tests.js +++ b/addons/mail/static/tests/composer/composer_tests.js @@ -813,6 +813,15 @@ QUnit.test("Show recipient list when there is more than 5 followers.", async () await contains(".o-mail-Chatter", { text: "To: test1, test2, test3, test4, test5, …" }); }); +QUnit.test("Show 'No recipient found.' with 0 followers.", async () => { + const pyEnv = await startServer(); + const partnerId = pyEnv["res.partner"].create({ name: "test name 1", email: "test1@odoo.com" }); + const { openFormView } = await start(); + await openFormView("res.partner", partnerId); + await click("button", { text: "Send message" }); + await contains(".o-mail-Chatter-top", { text: "To: No recipient" }); +}); + QUnit.test( "Uploading multiple files in the composer create multiple temporary attachments", async () => {