diff options
| author | Alexandre Kühn <aku@odoo.com> | 2020-02-24 09:46:09 +0000 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2020-02-25 14:50:21 +0000 |
| commit | 86fd7ab4f0a4eabf4ff6f8b9dd00b5733e4f0253 (patch) | |
| tree | b8abfbe062dcbea34106e049996c19911fb5c36c /addons/mail/static/src/js/services | |
| parent | 06d842d31f699d794d7318cda65ea0ec3262d1af (diff) | |
[FIX] mail: improve discuss new channel handling in mobile
Revision on https://github.com/odoo/odoo/commit/8e5b6ab02aa95c204ea7bd241e6b8944d5972d43
Intent of commit above was to remove server-side synchronization of
chat windows in mobile. To do so, it prevented sending RPCs for chat
window state in mobile, in addition to not automatically adapt state
of chat windows in mobile from longpolling notification.
This implementation, while functionally working as intended, had
disturbing intermediate logic that could potentially lead to bugs
in the future. Specifically, on mobile, new channel did not directly
trigger a re-render of discuss widgets. However, and thankfully, the
related new message was triggering the rendering, so that UI
correctly has channel and its notification.
This commit simply improves code so that new channel always triggers
a rendering, even in mobile, like before the commit above. Of course,
to preserve the intent of not synchronizing chat windows in mobile,
new detached channels must still not auto-open a chat window, and
this commit clarifies this intended behaviour in the code.
X-original-commit: 1046d063ca46aacb1e186599b5d4a02ef9c8e18d
Diffstat (limited to 'addons/mail/static/src/js/services')
| -rw-r--r-- | addons/mail/static/src/js/services/mail_manager.js | 10 | ||||
| -rw-r--r-- | addons/mail/static/src/js/services/mail_window_manager.js | 12 |
2 files changed, 7 insertions, 15 deletions
diff --git a/addons/mail/static/src/js/services/mail_manager.js b/addons/mail/static/src/js/services/mail_manager.js index 64e733abf43..6a2fe69581d 100644 --- a/addons/mail/static/src/js/services/mail_manager.js +++ b/addons/mail/static/src/js/services/mail_manager.js @@ -903,11 +903,6 @@ var MailManager = AbstractService.extend({ args: [[channelID]], }) .then(function (result) { - // Prevent to automatically open chat window when a new message - // is received on mobile. - if (config.device.isMobile) { - options.silent = true; - } return self._addChannel(result, options); }); }, @@ -1235,11 +1230,6 @@ var MailManager = AbstractService.extend({ var proms = []; const options = {}; - // Prevent to automatically open all chat windows at initial loading. - if (config.device.isMobile) { - options.silent = true; - } - _.each(data.channel_slots, function (channels) { _.each(channels, function (channel) { proms.push(self._addChannel(channel, options)); diff --git a/addons/mail/static/src/js/services/mail_window_manager.js b/addons/mail/static/src/js/services/mail_window_manager.js index 57b7623e05a..9cbb77e529d 100644 --- a/addons/mail/static/src/js/services/mail_window_manager.js +++ b/addons/mail/static/src/js/services/mail_window_manager.js @@ -658,11 +658,13 @@ MailManager.include({ */ _onNewChannel: function (channel, proms) { if (channel.isDetached()) { - var prom = this.openThreadWindow(channel.getID(), { - keepFoldState: true, - passively: true, - }); - proms.push(prom); + if (!config.device.isMobile) { + var prom = this.openThreadWindow(channel.getID(), { + keepFoldState: true, + passively: true, + }); + proms.push(prom); + } } else { this._closeThreadWindow(channel.getID()); } |
