summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/thread.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2016-01-27 10:37:24 +0100
committerAaron Bohy <aab@odoo.com>2016-01-29 13:21:02 +0100
commitc04103f4da7f24df4010fdd68ac815e24c9c949a (patch)
treeda8dddfc0eebecfc4f2c1e4afba74bc98a37623c /addons/mail/static/src/js/thread.js
parent628a6146d2da1a66e44acb10969c3a9555b88b0c (diff)
[FIX] mail: various UI fixes/improvements
- don't print chat windows - add missing 'width: 100%' on composer and Discuss sidebar inputs (required for community edition) - center the Discuss sidebar inputs - Discuss sidebar items layout: one line, text ellipsis if name is too long - hide chatter in 'create' mode (messages wrote in the chatter need a res_model and a res_id, the latter is not yet existing if we are in 'create' mode) - revert 2d2dacc: print chatter by default (classname 'hidden-print' can be used for specific models for which we don't want the chatter to be printed) - thread: ensure the displayed message's date is in the past - re-render threads every minutes to update dates - don't squash messages in mass mailing channels
Diffstat (limited to 'addons/mail/static/src/js/thread.js')
-rw-r--r--addons/mail/static/src/js/thread.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/addons/mail/static/src/js/thread.js b/addons/mail/static/src/js/thread.js
index 439b1a8beb3..d0123c0457e 100644
--- a/addons/mail/static/src/js/thread.js
+++ b/addons/mail/static/src/js/thread.js
@@ -58,6 +58,8 @@ var Thread = Widget.extend({
},
render: function (messages, options) {
+ clearTimeout(this.auto_render_timeout);
+ var self = this;
var msgs = _.map(messages, this._preprocess_message.bind(this));
if (this.options.display_order === ORDER.DESC) {
msgs.reverse();
@@ -83,6 +85,12 @@ var Thread = Widget.extend({
options: options,
ORDER: ORDER,
}));
+
+ this.auto_render_timeout = setTimeout(function () {
+ if (!self.isDestroyed()) {
+ self.render(messages, options);
+ }
+ }, 1000*60); // re-render the thread every minute to update dates
},
on_click_redirect: function (event) {
@@ -110,7 +118,7 @@ var Thread = Widget.extend({
_preprocess_message: function (message) {
var msg = _.extend({}, message);
- // Set the date in the browser timezone
+ msg.date = moment.min(msg.date, moment());
var date = msg.date.format('YYYY-MM-DD');
if (date === moment().format('YYYY-MM-DD')) {