From fd68c7d3438a021f17c0cc30bd685093647f2cda Mon Sep 17 00:00:00 2001 From: "Didier (did)" Date: Mon, 9 Oct 2023 11:45:41 +0200 Subject: [PATCH] [FIX] mail: allow empty message edition Before this PR, it was not possible to edit a message that has an empty body. Task-3387170 closes odoo/odoo#137996 Signed-off-by: Didier Debondt (did) --- .../mail/static/src/core/common/message.xml | 2 +- .../static/tests/message/message_tests.js | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/core/common/message.xml b/addons/mail/static/src/core/common/message.xml index ada261d1e7d..6d3c03af0a3 100644 --- a/addons/mail/static/src/core/common/message.xml +++ b/addons/mail/static/src/core/common/message.xml @@ -72,7 +72,7 @@ >
- +
diff --git a/addons/mail/static/tests/message/message_tests.js b/addons/mail/static/tests/message/message_tests.js index 17d1c32e481..2c66530691a 100644 --- a/addons/mail/static/tests/message/message_tests.js +++ b/addons/mail/static/tests/message/message_tests.js @@ -1594,3 +1594,28 @@ QUnit.test("Message should display attachments in order", async () => { await contains(":nth-child(2 of .o-mail-AttachmentCard)", { text: "B.txt" }); await contains(":nth-child(3 of .o-mail-AttachmentCard)", { text: "C.txt" }); }); + +QUnit.test("Can edit a message only containing an attachment", async () => { + const pyEnv = await startServer(); + const channelId = pyEnv["discuss.channel"].create({ + name: "general", + channel_type: "channel", + }); + const attachmentId = pyEnv["ir.attachment"].create({ + name: "Blah.jpg", + mimetype: "image/jpeg", + }); + pyEnv["mail.message"].create({ + attachment_ids: [attachmentId], + author_id: pyEnv.currentPartnerId, + body: "", + model: "discuss.channel", + res_id: channelId, + message_type: "comment", + }); + const { openDiscuss } = await start(); + openDiscuss(channelId); + await click(".o-mail-Message [title='Expand']"); + await click(".o-mail-Message [title='Edit']"); + await contains(".o-mail-Message-editable .o-mail-Composer-input"); +});