[FIX] mail: squashed message don't grow on mousehover
Before this commit, when a message without bubble layout is squashed (e.g. with `/who` command twice in a channel), mouse-hovering on the squashed message pushed increased the height of the message. This happens because the sidebar of squashed message contains the date and it uses 12-hour format with AM/PM. This design requires cautious use of content in the sidebar, and had 24-hour format to make it work. A recent refactoring changed it to 12-hour format as localization was a better concern. However, the UI is not designed for it, and there's not much value in having 12-hour format rather than 24-hour format. Indeed, users assume AM if no AM/PM is shown, except if hour is greater than 12 which is quite obvious the current time. 12-hour format is best for some users, but we can't have it without overhauling parts of the UI which is not worth it at the time of this commit. Therefore using 24-hour format is the better tradeoff. Also took the opportunity of this PR to better align the date and seen indicator in squashed message sidebar. Task-3637270 closes odoo/odoo#150369 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
@@ -19,10 +19,10 @@
|
||||
<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">
|
||||
<small t-if="isActive and props.showDates" class="o-mail-Message-date text-muted opacity-75 ms-2">
|
||||
<small t-if="isActive and props.showDates" class="o-mail-Message-date text-muted opacity-75">
|
||||
<t t-esc="messageService.dateSimple(message)"/>
|
||||
</small>
|
||||
<div t-else="" class="ms-2">
|
||||
<div t-else="">
|
||||
<MessageSeenIndicator
|
||||
t-if="props.message.isSelfAuthored and props.thread"
|
||||
message="props.message"
|
||||
|
||||
@@ -162,13 +162,13 @@ export class MessageService {
|
||||
}
|
||||
|
||||
scheduledDateSimple(message) {
|
||||
return message.scheduledDate.toLocaleString(DateTime.TIME_SIMPLE, {
|
||||
return message.scheduledDate.toLocaleString(DateTime.TIME_24_SIMPLE, {
|
||||
locale: this.userService.lang?.replace("_", "-"),
|
||||
});
|
||||
}
|
||||
|
||||
dateSimple(message) {
|
||||
return message.datetime.toLocaleString(DateTime.TIME_SIMPLE, {
|
||||
return message.datetime.toLocaleString(DateTime.TIME_24_SIMPLE, {
|
||||
locale: this.userService.lang?.replace("_", "-"),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,7 +7,12 @@ import { start } from "@mail/../tests/helpers/test_utils";
|
||||
|
||||
import { deserializeDateTime } from "@web/core/l10n/dates";
|
||||
import { getOrigin } from "@web/core/utils/urls";
|
||||
import { makeDeferred, patchWithCleanup, triggerHotkey } from "@web/../tests/helpers/utils";
|
||||
import {
|
||||
makeDeferred,
|
||||
patchTimeZone,
|
||||
patchWithCleanup,
|
||||
triggerHotkey,
|
||||
} from "@web/../tests/helpers/utils";
|
||||
import { click, contains, insertText } from "@web/../tests/utils";
|
||||
import { SIZES, patchUiSize } from "../helpers/patch_ui_size";
|
||||
|
||||
@@ -671,6 +676,7 @@ QUnit.test("message comment of same author within 1min. should be squashed", asy
|
||||
// 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
|
||||
// be working in non-mailboxes
|
||||
patchTimeZone(0); // so it matches server timezone
|
||||
const pyEnv = await startServer();
|
||||
const channelId = pyEnv["discuss.channel"].create({ name: "general" });
|
||||
const partnerId = pyEnv["res.partner"].create({ name: "Demo" });
|
||||
@@ -713,7 +719,7 @@ QUnit.test("message comment of same author within 1min. should be squashed", asy
|
||||
await contains(".o-mail-Message", {
|
||||
contains: [
|
||||
[".o-mail-Message-content", { text: "body2" }],
|
||||
[".o-mail-Message-sidebar .o-mail-Message-date"],
|
||||
[".o-mail-Message-sidebar .o-mail-Message-date", { text: "10:00" }],
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user