From bd7aeae189b03768bcf799002a0b291e33cb84e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Tue, 15 Dec 2020 12:33:54 +0000 Subject: [PATCH] [FIX] mail: prevent messaging menu from hiding home menu in mobile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit task-2330277 closes odoo/odoo#63405 X-original-commit: db7f4437a644b93a5227f663fa19dda00817c13c Signed-off-by: Alexandre Kühn (aku) --- .../static/src/components/messaging_menu/messaging_menu.js | 6 ------ addons/mail/static/src/models/chat_window/chat_window.js | 7 +++++++ .../static/src/models/messaging_menu/messaging_menu.js | 6 +----- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/addons/mail/static/src/components/messaging_menu/messaging_menu.js b/addons/mail/static/src/components/messaging_menu/messaging_menu.js index 4e5ede8f635..a9a78521090 100644 --- a/addons/mail/static/src/components/messaging_menu/messaging_menu.js +++ b/addons/mail/static/src/components/messaging_menu/messaging_menu.js @@ -111,12 +111,6 @@ class MessagingMenu extends Component { */ return; } - // in mobile: keeps the messaging menu open in background - // TODO: maybe need to move this to a mobile component? - // task-2089887 - if (this.env.messaging.device.isMobile) { - return; - } // ignore click inside the menu if (this.el.contains(ev.target)) { return; diff --git a/addons/mail/static/src/models/chat_window/chat_window.js b/addons/mail/static/src/models/chat_window/chat_window.js index 4d51d952696..4bb1fe2442b 100644 --- a/addons/mail/static/src/models/chat_window/chat_window.js +++ b/addons/mail/static/src/models/chat_window/chat_window.js @@ -50,6 +50,13 @@ function factory(dependencies) { if (thread && notifyServer) { thread.notifyFoldStateToServer('closed'); } + if (this.env.device.isMobile && !this.env.messaging.discuss.isOpen) { + // If we are in mobile and discuss is not open, it means the + // chat window was opened from the messaging menu. In that + // case it should be re-opened to simulate it was always + // there in the background. + this.env.messaging.messagingMenu.update({ isOpen: true }); + } } expand() { diff --git a/addons/mail/static/src/models/messaging_menu/messaging_menu.js b/addons/mail/static/src/models/messaging_menu/messaging_menu.js index 654efa4b828..60212930d0f 100644 --- a/addons/mail/static/src/models/messaging_menu/messaging_menu.js +++ b/addons/mail/static/src/models/messaging_menu/messaging_menu.js @@ -16,11 +16,7 @@ function factory(dependencies) { * Close the messaging menu. Should reset its internal state. */ close() { - this.update({ - activeTabId: 'all', - isMobileNewMessageToggled: false, - isOpen: false, - }); + this.update({ isOpen: false }); } /**