From bdf45dca506f9938bfcd3a7acc8757a16d701d05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Thu, 13 Jun 2019 13:53:01 +0000 Subject: [FIX] mail: auto-update out-of-office info on im_status change Before this commit, chat window's out-of-office info did not change when direct partner's `im_status` is/was on 'leave'. Users had to reload page to see updated out-of-office info. Task-ID 2007663 --- .../mail/static/src/js/thread_windows/thread_window.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'addons/mail/static/src/js/thread_windows/thread_window.js') diff --git a/addons/mail/static/src/js/thread_windows/thread_window.js b/addons/mail/static/src/js/thread_windows/thread_window.js index e5496e0bc3c..9f7c1f00bb5 100644 --- a/addons/mail/static/src/js/thread_windows/thread_window.js +++ b/addons/mail/static/src/js/thread_windows/thread_window.js @@ -6,6 +6,7 @@ var BasicComposer = require('mail.composer.Basic'); var core = require('web.core'); +var QWeb = core.qweb; var _t = core._t; /** @@ -153,6 +154,23 @@ var ThreadWindow = AbstractThreadWindow.extend({ removePassive: function () { this._passive = false; }, + renderOutOfOffice: function () { + var $outOfOffice = this.$('.o_out_of_office'); + if (!this.getOutOfOfficeInfo() && !this.getOutOfOfficeMessage()) { + if ($outOfOffice.length) { + $outOfOffice.remove(); + } + return; + } + var $newOutOfOffice = $(QWeb.render('mail.thread_window.OutOfOffice', { + widget: this, + })); + if ($outOfOffice.length) { + $outOfOffice.replaceWith($newOutOfOffice); + } else { + $newOutOfOffice.insertAfter(this.$('.o_thread_window_header')); + } + }, /** * Update this thread window * -- cgit v1.2.3