[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
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user