Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions addons/mail/static/src/core/common/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ export class Message extends Component {
this.message.translationValue,
this.props.messageSearch?.searchTerm,
this.message.body,
this.message.composer,
]
);
}
Expand Down Expand Up @@ -409,6 +410,8 @@ export class Message extends Component {
if (!bodyEl) {
return;
}
const editedEl = bodyEl.querySelector(".o-mail-Message-edited");
editedEl?.replaceChildren(renderToElement("mail.Message.edited"));
const linkEls = bodyEl.querySelectorAll(".o_channel_redirect");
for (const linkEl of linkEls) {
const text = linkEl.textContent.substring(1); // remove '#' prefix
Expand Down
4 changes: 0 additions & 4 deletions addons/mail/static/src/core/common/message.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
opacity: 50%;
}

.o-mail-Message-edited {
display: none;
}

.o-mail-Message-seenContainer {
font-size: 0.65rem;
right: 2px;
Expand Down
5 changes: 4 additions & 1 deletion addons/mail/static/src/core/common/message.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
<div class="overflow-x-auto" t-if="message.message_type and message.message_type.includes('email')" t-ref="shadowBody"/>
<t t-elif="state.showTranslation" t-out="message.translationValue"/>
<t t-elif="message.body" t-out="props.messageSearch?.highlight(message.body) ?? message.body"/>
<em t-if="message.edited" class="smaller fw-bold text-500"> (edited)</em>
<p class="fst-italic text-muted small" t-if="state.showTranslation">
<t t-if="message.translationSource" t-esc="translatedFromText"/>
</p>
Expand Down Expand Up @@ -130,6 +129,10 @@
</ActionSwiper>
</t>

<t t-name="mail.Message.edited">
<em class="smaller fw-bold text-500"> (edited)</em>
</t>

<t t-name="mail.Message.actions">
<div t-if="props.hasActions and message.hasActions and !state.isEditing" class="o-mail-Message-actions d-print-none"
t-att-class="{
Expand Down
5 changes: 5 additions & 0 deletions addons/mail/static/tests/message/message.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ test("Can edit message comment in chatter", async () => {
await insertText(".o-mail-Message .o-mail-Composer-input", "edited message", { replace: true });
await click(".o-mail-Message a", { text: "save" });
await contains(".o-mail-Message-content", { text: "edited message (edited)" });
// save without change should keep (edited)
await click(".o-mail-Message [title='Expand']");
await click(".o-mail-Message-moreMenu [title='Edit']");
await click(".o-mail-Message a", { text: "save" });
await contains(".o-mail-Message-content", { text: "edited message (edited)" });
});

test("Can edit message comment in chatter (mobile)", async () => {
Expand Down