From 730efcc3df71174d6267392efac527efcd740956 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Thu, 1 Oct 2015 09:17:08 +0200 Subject: [PATCH] [FIX] mail: mark a message as read should not hide 'load more' button It was hidding it because the method that removes a message from the thread didn't pass the options for the thread rendering, and the flag specifiying whether or not the 'load more' button should be displayed is in this options object. --- addons/mail/static/src/js/client_action.js | 3 ++- addons/mail/static/src/js/thread.js | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/mail/static/src/js/client_action.js b/addons/mail/static/src/js/client_action.js index ba319c81c2c..ca880978ee4 100644 --- a/addons/mail/static/src/js/client_action.js +++ b/addons/mail/static/src/js/client_action.js @@ -409,7 +409,8 @@ var ChatAction = Widget.extend(ControlPanelMixin, { if ((this.channel_id === "channel_starred" && !message.is_starred) || (this.channel_id === "channel_inbox" && !message.is_needaction)) { chat_manager.fetch(this.channel_id, this.domain).then(function (messages) { - self.thread.remove_message_and_render(message.id, messages); + var options = {display_load_more: !chat_manager.all_history_loaded(self.channel_id)}; + self.thread.remove_message_and_render(message.id, messages, options); }); } else if (_.contains(message.channel_ids, this.channel_id)) { this.fetch_and_render_thread(); diff --git a/addons/mail/static/src/js/thread.js b/addons/mail/static/src/js/thread.js index ede5aa40604..ffe13dbb7ae 100644 --- a/addons/mail/static/src/js/thread.js +++ b/addons/mail/static/src/js/thread.js @@ -91,11 +91,12 @@ var Thread = Widget.extend({ * Removes a message and re-renders the thread * @param {int} [message_id] the id of the removed message * @param {array} [messages] the list of messages to display, without the removed one + * @param {object} [options] options for the thread rendering */ - remove_message_and_render: function (message_id, messages) { + remove_message_and_render: function (message_id, messages, options) { var self = this; this.$('.o_thread_message[data-message-id=' + message_id + ']').fadeOut({ - done: function () { self.render(messages); } + done: function () { self.render(messages, options); } }); },