summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/window_manager.js
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2015-11-04 14:20:55 +0100
committerGéry Debongnie <ged@odoo.com>2015-11-09 16:36:29 +0100
commit2bb55ecb041ebdc1074cbf6e138ad24df1fe0581 (patch)
tree86d19ada6a3ec91d194e1215f3d4f11b7bc3ec4c /addons/mail/static/src/js/window_manager.js
parentfb013ce292bc0fdb4a2031de63ff56308471dfe4 (diff)
[FIX] mail: issue when leaving channel and refreshing
When we refresh, the bus will send the last notifications since the last 50s, so, the browser will receive notifications from a channel that we already left. This commits tries to fix the issue by sending explicitely the information that a channel was unsubscribed. Also, and this is touchy, it ignores messages received in a channel that it is not subscribed to (before, it joined the channel) Also, it will synchronize channels opened and closed in various tabs/browsers.
Diffstat (limited to 'addons/mail/static/src/js/window_manager.js')
-rw-r--r--addons/mail/static/src/js/window_manager.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/addons/mail/static/src/js/window_manager.js b/addons/mail/static/src/js/window_manager.js
index 5c9a24b6dc5..aacf2a2919f 100644
--- a/addons/mail/static/src/js/window_manager.js
+++ b/addons/mail/static/src/js/window_manager.js
@@ -106,6 +106,14 @@ core.bus.on('web_client_ready', null, function () {
});
});
+ chat_manager.bus.on('unsubscribe_from_channel', null, function (channel_id) {
+ _.each(chat_sessions, function (session) {
+ if (channel_id === session.id) {
+ close_chat(session);
+ }
+ });
+ });
+
chat_manager.is_ready.then(function() {
_.each(chat_manager.get_channels(), function (channel) {
if (channel.is_detached) {