summaryrefslogtreecommitdiff
path: root/addons/mail/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-02-17 17:48:03 +0100
committerChristophe Simonis <chs@odoo.com>2016-02-17 17:48:03 +0100
commit5be43b8d9ae4485ac28e9afb7dd7cdecefb58abc (patch)
tree483b65cfc65fb4f57a32f841424812575ebdbc84 /addons/mail/static/src
parent6999a862fdff34ea7d05ba90c2977f2c386cb506 (diff)
parent27058c4763b40c5ef9b2b81c9f8a2de8d68469af (diff)
[MERGE] forward port of branch 9.0 up to 27058c4
Diffstat (limited to 'addons/mail/static/src')
-rw-r--r--addons/mail/static/src/js/chat_manager.js14
-rw-r--r--addons/mail/static/src/js/client_action.js2
2 files changed, 10 insertions, 6 deletions
diff --git a/addons/mail/static/src/js/chat_manager.js b/addons/mail/static/src/js/chat_manager.js
index 0dc41db8f0d..d1c17e1b965 100644
--- a/addons/mail/static/src/js/chat_manager.js
+++ b/addons/mail/static/src/js/chat_manager.js
@@ -148,7 +148,7 @@ function add_message (data, options) {
var msg = _.findWhere(messages, { id: data.id });
if (!msg) {
- msg = make_message(data);
+ msg = chat_manager.make_message(data);
// Keep the array ordered by id when inserting the new message
messages.splice(_.sortedIndex(messages, msg, 'id'), 0, msg);
_.each(msg.channel_ids, function (channel_id) {
@@ -298,7 +298,7 @@ function add_channel (data, options) {
chat_manager.bus.trigger("channel_toggle_fold", channel);
}
} else {
- channel = make_channel(data, options);
+ channel = chat_manager.make_channel(data, options);
channels.push(channel);
channels = _.sortBy(channels, function (channel) { return channel.name.toLowerCase(); });
if (!options.silent) {
@@ -677,6 +677,10 @@ function on_presence_notification (data) {
// Public interface
//----------------------------------------------------------------------------------
var chat_manager = {
+ // these two functions are exposed for extensibility purposes and shouldn't be called by other modules
+ make_message: make_message,
+ make_channel: make_channel,
+
post_message: function (data, options) {
options = options || {};
var msg = {
@@ -773,9 +777,9 @@ var chat_manager = {
return $.when();
}
},
- mark_all_as_read: function (channel) {
- if ((!channel && needaction_counter) || (channel && channel.needaction_counter)) {
- return MessageModel.call('mark_all_as_read', channel ? [[channel.id]] : []);
+ mark_all_as_read: function (channel, domain) {
+ if ((channel.id === "channel_inbox" && needaction_counter) || (channel && channel.needaction_counter)) {
+ return MessageModel.call('mark_all_as_read', [], {channel_ids: channel.id !== "channel_inbox" ? [channel.id] : [], domain: domain});
}
return $.when();
},
diff --git a/addons/mail/static/src/js/client_action.js b/addons/mail/static/src/js/client_action.js
index 442e00e6b94..090b2025239 100644
--- a/addons/mail/static/src/js/client_action.js
+++ b/addons/mail/static/src/js/client_action.js
@@ -200,7 +200,7 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
self.$('.o_mail_chat_sidebar').slideToggle(200);
});
this.$buttons.on('click', '.o_mail_chat_button_mark_read', function () {
- chat_manager.mark_all_as_read();
+ chat_manager.mark_all_as_read(self.channel, self.domain);
});
this.$buttons.on('click', '.o_mail_chat_button_unstar_all', chat_manager.unstar_all);
this.$buttons.on('click', '.o_mail_chat_button_new_message', this.on_click_new_message);