[FIX] mail: Opening hidden chat window should swap
When we have more chat windows open than can be shown on screen, they get hidden. When we try to open one of the hidden chat windows from the messaging menu of the system tray, the chat window will unfold in the hidden menu. This commit fixes this issue by swapping the hidden chat window that is being opened with the last visible chat window. opw-3478264 closes odoo/odoo#133128 X-original-commit: 3649d3c0ba5a8999264b9746cfac0d9a4d1cc061 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
committed by
Alexandre Kühn
parent
a9707ac099
commit
138c61afd1
@@ -118,6 +118,9 @@ export class ChatWindowService {
|
||||
);
|
||||
return this.store.chatWindows[index]; // return reactive version
|
||||
}
|
||||
if (chatWindow.hidden) {
|
||||
this.makeVisible(chatWindow);
|
||||
}
|
||||
assignDefined(chatWindow, data);
|
||||
return chatWindow;
|
||||
}
|
||||
|
||||
@@ -465,6 +465,38 @@ QUnit.test("closing hidden chat window", async (assert) => {
|
||||
await contains(":not(.o-mail-ChatWindowHiddenMenu) .o-mail-ChatWindow:contains(Ch_4)");
|
||||
});
|
||||
|
||||
QUnit.test("Opening hidden chat window from messaging menu", async (assert) => {
|
||||
const pyEnv = await startServer();
|
||||
pyEnv["discuss.channel"].create([{ name: "Ch_1" }, { name: "Ch_2" }, { name: "Ch_3" }]);
|
||||
patchUiSize({ width: 900 });
|
||||
assert.ok(
|
||||
CHAT_WINDOW_END_GAP_WIDTH * 2 + CHAT_WINDOW_WIDTH * 2 + CHAT_WINDOW_INBETWEEN_WIDTH < 900,
|
||||
"should have enough space to open 2 chat windows simultaneously"
|
||||
);
|
||||
assert.ok(
|
||||
CHAT_WINDOW_END_GAP_WIDTH * 2 + CHAT_WINDOW_WIDTH * 3 + CHAT_WINDOW_INBETWEEN_WIDTH * 2 >
|
||||
900,
|
||||
"should not have enough space to open 3 chat windows simultaneously"
|
||||
);
|
||||
await start();
|
||||
await click("i[aria-label='Messages']");
|
||||
await click(".o-mail-NotificationItem:contains(Ch_1)");
|
||||
await click("i[aria-label='Messages']");
|
||||
await click(".o-mail-NotificationItem:contains(Ch_2)");
|
||||
await click("i[aria-label='Messages']");
|
||||
await click(".o-mail-NotificationItem:contains(Ch_3)");
|
||||
await click(".o-mail-ChatWindowHiddenToggler");
|
||||
await contains(":not(.o-mail-ChatWindowHiddenMenu) .o-mail-ChatWindow:contains(Ch_1)");
|
||||
await contains(".o-mail-ChatWindowHiddenMenu .o-mail-ChatWindow:contains(Ch_2)");
|
||||
await contains(":not(.o-mail-ChatWindowHiddenMenu) .o-mail-ChatWindow:contains(Ch_3)");
|
||||
await click("i[aria-label='Messages']");
|
||||
await click(".o-mail-NotificationItem:contains(Ch_2)");
|
||||
await click(".o-mail-ChatWindowHiddenToggler");
|
||||
await contains(":not(.o-mail-ChatWindowHiddenMenu) .o-mail-ChatWindow:contains(Ch_1)");
|
||||
await contains(":not(.o-mail-ChatWindowHiddenMenu) .o-mail-ChatWindow:contains(Ch_2)");
|
||||
await contains(".o-mail-ChatWindowHiddenMenu .o-mail-ChatWindow:contains(Ch_3)");
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"focus next visible chat window when closing current chat window with ESCAPE [REQUIRE FOCUS]",
|
||||
async (assert) => {
|
||||
|
||||
Reference in New Issue
Block a user