[FIX] mail: squashed transient message has date
Before this commit:
Squashed transient messages had date displayed in the sidebar of the message.
This was introduced by this commit: 631ae1c
After this commit:
Squashed transient messages would not have date in the message sidebar.
closes odoo/odoo#154594
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
<div t-if="!props.squashed" class="o-mail-Message-avatarContainer position-relative bg-view">
|
||||
<img class="o-mail-Message-avatar w-100 h-100 rounded" t-att-src="authorAvatarUrl" t-att-class="authorAvatarAttClass"/>
|
||||
</div>
|
||||
<t t-elif="!message.isTransient">
|
||||
<t t-elif="!message.is_transient">
|
||||
<small t-if="isActive and props.showDates" class="o-mail-Message-date text-muted opacity-75">
|
||||
<t t-esc="messageService.dateSimple(message)"/>
|
||||
</small>
|
||||
|
||||
@@ -492,7 +492,7 @@ export class Thread extends Record {
|
||||
}
|
||||
|
||||
get persistentMessages() {
|
||||
return this.messages.filter((message) => !message.isTransient);
|
||||
return this.messages.filter((message) => !message.is_transient);
|
||||
}
|
||||
|
||||
get prefix() {
|
||||
|
||||
@@ -9,6 +9,8 @@ import { deserializeDateTime } from "@web/core/l10n/dates";
|
||||
import { getOrigin } from "@web/core/utils/urls";
|
||||
import {
|
||||
makeDeferred,
|
||||
nextTick,
|
||||
patchDate,
|
||||
patchTimeZone,
|
||||
patchWithCleanup,
|
||||
triggerHotkey,
|
||||
@@ -672,6 +674,41 @@ QUnit.test("should not be able to reply to temporary/transient messages", async
|
||||
await contains(".o-mail-Message [title='Reply']", { count: 0 });
|
||||
});
|
||||
|
||||
QUnit.test("squashed transient message should not have date in the sidebar", async () => {
|
||||
patchDate(2024, 2, 26, 10, 0, 0);
|
||||
const pyEnv = await startServer();
|
||||
const channelId = pyEnv["discuss.channel"].create({ name: "Channel 1" });
|
||||
pyEnv["mail.message"].create([
|
||||
{
|
||||
body: "Hello world 1",
|
||||
model: "discuss.channel",
|
||||
res_id: channelId,
|
||||
},
|
||||
{
|
||||
body: "Hello world 2",
|
||||
model: "discuss.channel",
|
||||
res_id: channelId,
|
||||
},
|
||||
]);
|
||||
const { openDiscuss } = await start();
|
||||
await openDiscuss(channelId);
|
||||
await click(".o-mail-Message.o-squashed");
|
||||
await contains(".o-mail-Message.o-squashed .o-mail-Message-sidebar", {
|
||||
text: "10:00",
|
||||
});
|
||||
await insertText(".o-mail-Composer-input", "/who");
|
||||
await click(".o-mail-Composer-send:enabled");
|
||||
await contains(".o-mail-Message", { text: "You are alone in this channel." });
|
||||
await insertText(".o-mail-Composer-input", "/who");
|
||||
await click(".o-mail-Composer-send:enabled");
|
||||
await click(":nth-child(2 of .o-mail-Message.o-squashed");
|
||||
await nextTick();
|
||||
await contains(":nth-child(2 of .o-mail-Message.o-squashed) .o-mail-Message-sidebar", {
|
||||
text: "10:00",
|
||||
count: 0,
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test("message comment of same author within 1min. should be squashed", async () => {
|
||||
// messages are squashed when "close", e.g. less than 1 minute has elapsed
|
||||
// from messages of same author and same thread. Note that this should
|
||||
|
||||
Reference in New Issue
Block a user