summaryrefslogtreecommitdiff
path: root/addons/im/static/src
diff options
context:
space:
mode:
authorniv-openerp <nicolas.vanhoren@openerp.com>2013-09-04 15:17:53 +0200
committerniv-openerp <nicolas.vanhoren@openerp.com>2013-09-04 15:17:53 +0200
commit85e52d1f86dfe60f1ca43fb81c7fb2c72d21cd95 (patch)
tree0b20dcfe4d18cc424ea60ea3d64a34af9d1fae4a /addons/im/static/src
parentacea8a695b97482114c052662a4731b60fff40fc (diff)
Now can disconnect from a group chat
bzr revid: nicolas.vanhoren@openerp.com-20130904131753-bdp93e8vwtg4za7n
Diffstat (limited to 'addons/im/static/src')
-rw-r--r--addons/im/static/src/js/im_common.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/addons/im/static/src/js/im_common.js b/addons/im/static/src/js/im_common.js
index 2d7dcd1cae5..e0692edca2b 100644
--- a/addons/im/static/src/js/im_common.js
+++ b/addons/im/static/src/js/im_common.js
@@ -295,7 +295,7 @@ function declare($, _, openerp) {
className: "openerp_style oe_im_chatview",
events: {
"keydown input": "keydown",
- "click .oe_im_chatview_close": "destroy",
+ "click .oe_im_chatview_close": "close",
"click .oe_im_chatview_header": "show_hide"
},
init: function(parent, c_manager, session_id, options) {
@@ -467,6 +467,20 @@ function declare($, _, openerp) {
if (! this.shown)
this.show_hide();
},
+ close: function() {
+ var def = $.when();
+ if (this.get("users").length > 1) {
+ def = im_common.connection.model("im.session").call("remove_me_from_session",
+ [this.session_id, this.c_manager.me.get("uuid")]).then(_.bind(function() {
+ return this.send_message(JSON.stringify({"type": "session_modified", "action": "removed",
+ "user_id": this.c_manager.me.get("id")}), true)
+ }, this))
+ }
+
+ return def.then(_.bind(function() {
+ this.destroy();
+ }, this));
+ },
destroy: function() {
_.each(this.get("users"), function(user) {
user.remove_watcher();