summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/window_manager.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2015-12-10 13:05:58 +0100
committerChristophe Simonis <chs@odoo.com>2015-12-10 13:05:58 +0100
commit82a495eed52a9f42e5b88caa52c20a85f8d81ce3 (patch)
tree6c5e8cc0247d5fe08d24e9abae38fe353fbebc56 /addons/mail/static/src/js/window_manager.js
parent0bc2ddae784bf80c4c809d8b7f6d642d576f92a1 (diff)
parent4022493c0b85f966e499b6c03ac7cce5556f15e6 (diff)
[MERGE] forward port of branch saas-7 up to 4022493
Diffstat (limited to 'addons/mail/static/src/js/window_manager.js')
-rw-r--r--addons/mail/static/src/js/window_manager.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/addons/mail/static/src/js/window_manager.js b/addons/mail/static/src/js/window_manager.js
index 22eb60f9180..5a62c15ed8b 100644
--- a/addons/mail/static/src/js/window_manager.js
+++ b/addons/mail/static/src/js/window_manager.js
@@ -37,12 +37,25 @@ function open_chat (session) {
chat_manager.fold_channel(channel_id);
});
- chat_session.window.on("post_message", null, function (message) {
- chat_manager.post_message(message);
+ chat_session.window.on("post_message", null, function (message, channel_id) {
+ chat_manager.post_message(message, {channel_id: channel_id});
});
chat_session.window.on("messages_read", null, function () {
chat_manager.mark_channel_as_seen(channel);
});
+ chat_session.window.on("redirect", null, function (res_model, res_id) {
+ chat_manager.redirect(res_model, res_id, open_chat);
+ });
+ chat_session.window.on("redirect_to_channel", null, function (channel_id) {
+ var session = _.findWhere(chat_sessions, {id: channel_id});
+ if (!session) {
+ chat_manager.join_channel(channel_id).then(function (channel) {
+ chat_manager.detach_channel(channel);
+ });
+ } else {
+ session.window.toggle_fold(false);
+ }
+ });
chat_sessions.push(chat_session);
chat_session.window.appendTo($('body'))