diff options
| author | Sébastien Theys <seb@odoo.com> | 2021-01-15 17:47:01 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2021-01-15 17:47:01 +0000 |
| commit | fd46b3dcfd0a2419839f9b3a40b30c76538e0099 (patch) | |
| tree | 7c01ea93df95a3ba06aacaebb8701ba8ba40812e /addons/mail/static | |
| parent | 0d9a782681fcbd50ca687ae3158dc12f5b3571cb (diff) | |
[FIX] mail, sms: restore mobile app back button handlers
task-2347640
closes odoo/odoo#63313
Related: odoo/enterprise#15320
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static')
3 files changed, 33 insertions, 9 deletions
diff --git a/addons/mail/static/src/components/chat_window/chat_window.js b/addons/mail/static/src/components/chat_window/chat_window.js index 27d6bb68b68..8ae13de6d92 100644 --- a/addons/mail/static/src/components/chat_window/chat_window.js +++ b/addons/mail/static/src/components/chat_window/chat_window.js @@ -10,6 +10,8 @@ const useStore = require('mail/static/src/component_hooks/use_store/use_store.js const useUpdate = require('mail/static/src/component_hooks/use_update/use_update.js'); const { isEventHandled } = require('mail/static/src/utils/utils.js'); +const patchMixin = require('web.patchMixin'); + const { Component } = owl; const { useRef } = owl.hooks; @@ -49,19 +51,27 @@ class ChatWindow extends Component { * it has one! */ this._threadRef = useRef('thread'); + this._onWillHideHomeMenu = this._onWillHideHomeMenu.bind(this); + this._onWillShowHomeMenu = this._onWillShowHomeMenu.bind(this); // the following are passed as props to children this._onAutocompleteSelect = this._onAutocompleteSelect.bind(this); this._onAutocompleteSource = this._onAutocompleteSource.bind(this); + this._constructor(...args); } + /** + * Allows patching constructor. + */ + _constructor() {} + mounted() { - this.env.messagingBus.on('will_hide_home_menu', this, this._onWillHideHomeMenu.bind(this)); - this.env.messagingBus.on('will_show_home_menu', this, this._onWillShowHomeMenu.bind(this)); + this.env.messagingBus.on('will_hide_home_menu', this, this._onWillHideHomeMenu); + this.env.messagingBus.on('will_show_home_menu', this, this._onWillShowHomeMenu); } willUnmount() { - this.env.messagingBus.off('will_hide_home_menu', this, this._onWillHideHomeMenu.bind(this)); - this.env.messagingBus.off('will_show_home_menu', this, this._onWillShowHomeMenu.bind(this)); + this.env.messagingBus.off('will_hide_home_menu', this, this._onWillHideHomeMenu); + this.env.messagingBus.off('will_show_home_menu', this, this._onWillShowHomeMenu); } //-------------------------------------------------------------------------- @@ -343,6 +353,6 @@ Object.assign(ChatWindow, { template: 'mail.ChatWindow', }); -return ChatWindow; +return patchMixin(ChatWindow); }); diff --git a/addons/mail/static/src/components/dialog/dialog.js b/addons/mail/static/src/components/dialog/dialog.js index a71be619456..fa15f1c4b23 100644 --- a/addons/mail/static/src/components/dialog/dialog.js +++ b/addons/mail/static/src/components/dialog/dialog.js @@ -3,6 +3,8 @@ odoo.define('mail/static/src/components/dialog/dialog.js', function (require) { const useStore = require('mail/static/src/component_hooks/use_store/use_store.js'); +const patchMixin = require('web.patchMixin'); + const { Component } = owl; const { useRef } = owl.hooks; @@ -25,8 +27,14 @@ class Dialog extends Component { dialog: dialog ? dialog.__state : undefined, }; }); + this._constructor(); } + /** + * Allows patching constructor. + */ + _constructor() {} + mounted() { document.addEventListener('click', this._onClickGlobal, true); document.addEventListener('keydown', this._onKeydownDocument); @@ -104,6 +112,6 @@ Object.assign(Dialog, { template: 'mail.Dialog', }); -return Dialog; +return patchMixin(Dialog); }); 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 a9a78521090..89cb6b1fb7c 100644 --- a/addons/mail/static/src/components/messaging_menu/messaging_menu.js +++ b/addons/mail/static/src/components/messaging_menu/messaging_menu.js @@ -8,8 +8,9 @@ const components = { }; const useStore = require('mail/static/src/component_hooks/use_store/use_store.js'); +const patchMixin = require('web.patchMixin'); + const { Component } = owl; -const { useRef } = owl.hooks; class MessagingMenu extends Component { @@ -36,10 +37,15 @@ class MessagingMenu extends Component { // bind since passed as props this._onMobileNewMessageInputSelect = this._onMobileNewMessageInputSelect.bind(this); this._onMobileNewMessageInputSource = this._onMobileNewMessageInputSource.bind(this); - this._onClickCaptureGlobal = this._onClickCaptureGlobal.bind(this); + this._constructor(...args); } + /** + * Allows patching constructor. + */ + _constructor() {} + mounted() { document.addEventListener('click', this._onClickCaptureGlobal, true); } @@ -221,6 +227,6 @@ Object.assign(MessagingMenu, { template: 'mail.MessagingMenu', }); -return MessagingMenu; +return patchMixin(MessagingMenu); }); |
