[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) <did@odoo.com>
This commit is contained in:
Didier (did)
2024-01-10 07:26:59 +00:00
parent b2a8ab359f
commit 3e00a3f633
4 changed files with 21 additions and 2 deletions
+7
View File
@@ -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 ""
@@ -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 }) => {
+2 -2
View File
@@ -72,10 +72,10 @@
</button>
</div>
<t t-if="state.composerType">
<t t-if="state.composerType === 'message' and state.thread.recipients.length > 0">
<t t-if="state.composerType === 'message'">
<div class="flex-shrink-0 px-3 pt-3 text-truncate small mb-2" style="margin-left:48px">
<span class="fw-bold">To:</span> <t t-out="toRecipientsText"/>
<button class="o-mail-Chatter-recipientListButton btn btn-link badge rounded-pill border-0 p-1 ms-1" title="Show all recipients" t-on-click="onClickRecipientList">
<button t-if="state.thread.recipients.length > 0" class="o-mail-Chatter-recipientListButton btn btn-link badge rounded-pill border-0 p-1 ms-1" title="Show all recipients" t-on-click="onClickRecipientList">
<i class="fa fa-caret-down"/>
</button>
</div>
@@ -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 () => {