summaryrefslogtreecommitdiff
path: root/addons/mail/static/src
diff options
context:
space:
mode:
Diffstat (limited to 'addons/mail/static/src')
-rw-r--r--addons/mail/static/src/js/chat_manager.js15
-rw-r--r--addons/mail/static/src/js/chat_window.js5
-rw-r--r--addons/mail/static/src/js/client_action.js17
3 files changed, 23 insertions, 14 deletions
diff --git a/addons/mail/static/src/js/chat_manager.js b/addons/mail/static/src/js/chat_manager.js
index 3fa366dbe49..240355f79d4 100644
--- a/addons/mail/static/src/js/chat_manager.js
+++ b/addons/mail/static/src/js/chat_manager.js
@@ -179,6 +179,7 @@ function make_channel (data, options) {
is_folded: data.state === "folded",
autoswitch: 'autoswitch' in options ? options.autoswitch : true,
hidden: options.hidden,
+ display_needactions: options.display_needactions,
cache: {'[]': {
all_history_loaded: false,
loaded: false,
@@ -410,15 +411,15 @@ var chat_manager = {
// ---------------------------------------------------------------------------------
function init () {
add_channel({
- id: "channel_inbox",
- name: _t("Inbox"),
- type: "static"
- });
+ id: "channel_inbox",
+ name: _t("Inbox"),
+ type: "static",
+ }, { display_needactions: true });
add_channel({
- id: "channel_starred",
- name: _t("Starred"),
- type: "static"
+ id: "channel_starred",
+ name: _t("Starred"),
+ type: "static"
});
var load_channels = session.rpc('/mail/client_action').then(function (result) {
diff --git a/addons/mail/static/src/js/chat_window.js b/addons/mail/static/src/js/chat_window.js
index c9ca3675054..3a50082e017 100644
--- a/addons/mail/static/src/js/chat_window.js
+++ b/addons/mail/static/src/js/chat_window.js
@@ -27,7 +27,10 @@ return Widget.extend({
this.$content = this.$('.o_chat_content');
this.$input = this.$('.o_chat_input input');
- this.thread = new ChatThread(this, {display_avatar: false});
+ this.thread = new ChatThread(this, {
+ display_avatar: false,
+ display_needactions: false,
+ });
this.thread.on('toggle_star_status', this, function (message_id) {
this.trigger('toggle_star_status', message_id);
});
diff --git a/addons/mail/static/src/js/client_action.js b/addons/mail/static/src/js/client_action.js
index c6a872ae54e..7c72b1200c7 100644
--- a/addons/mail/static/src/js/client_action.js
+++ b/addons/mail/static/src/js/client_action.js
@@ -327,11 +327,17 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
});
},
+ get_thread_rendering_options: function () {
+ return {
+ display_load_more: !chat_manager.all_history_loaded(this.channel, this.domain),
+ display_needactions: this.channel.display_needactions,
+ };
+ },
+
fetch_and_render_thread: function () {
var self = this;
return chat_manager.fetch(this.channel, this.domain).then(function(result) {
- var history_loaded = chat_manager.all_history_loaded(self.channel, self.domain);
- self.thread.render(result, {display_load_more: !history_loaded});
+ self.thread.render(result, self.get_thread_rendering_options());
});
},
@@ -343,8 +349,7 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
return chat_manager
.fetch_more(this.channel, this.domain)
.then(function(result) {
- var history_loaded = chat_manager.all_history_loaded(self.channel, self.domain);
- self.thread.render(result, {display_load_more: !history_loaded});
+ self.thread.render(result, self.get_thread_rendering_options());
offset += framework.getPosition(document.querySelector(oldest_msg_selector)).top;
self.thread.scroll_to({offset: offset});
});
@@ -425,8 +430,8 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
if ((current_channel_id === "channel_starred" && !message.is_starred) ||
(current_channel_id === "channel_inbox" && !message.is_needaction)) {
chat_manager.fetch(this.channel, this.domain).then(function (messages) {
- var history_loaded = chat_manager.all_history_loaded(self.channel, self.domain);
- self.thread.remove_message_and_render(message.id, messages, {display_load_more: !history_loaded});
+ var options = self.get_thread_rendering_options();
+ self.thread.remove_message_and_render(message.id, messages, options);
});
} else if (_.contains(message.channel_ids, current_channel_id)) {
this.fetch_and_render_thread();