From c21d200285ebeb646b8e5be6ba233f96d9714c6f Mon Sep 17 00:00:00 2001 From: XavierDo Date: Mon, 7 Jan 2019 12:31:18 +0000 Subject: [IMP] mail: add ooo status in chats windows. In a chat window with a single usert (dm_chat) the ooo status of the other user is displayed on the top when set. Task: 1856205 --- .../src/js/thread_windows/abstract_thread_window.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'addons/mail/static/src/js/thread_windows/abstract_thread_window.js') diff --git a/addons/mail/static/src/js/thread_windows/abstract_thread_window.js b/addons/mail/static/src/js/thread_windows/abstract_thread_window.js index 3e4e2e16325..da958c1c5f1 100644 --- a/addons/mail/static/src/js/thread_windows/abstract_thread_window.js +++ b/addons/mail/static/src/js/thread_windows/abstract_thread_window.js @@ -147,6 +147,22 @@ var AbstractThreadWindow = Widget.extend({ } return this._thread; }, + /** + * Get out of office user text + * + * @returns {string|undefined} + */ + getOutOfOfficeMessage: function () { + if ( + !( + this.hasThread() && + this._thread.getType() === 'dm_chat' + ) + ) { + return undefined; + } + return this._thread.getOutOfOfficeMessage(); + }, /** * Get the status of the thread, such as the im status of a DM chat * ('online', 'offline', etc.). If this window has no thread, returns -- cgit v1.2.3 From 086405344e7302d9f7b243ba0c30d55131aeb3fe Mon Sep 17 00:00:00 2001 From: XavierDo Date: Mon, 7 Jan 2019 10:56:19 +0000 Subject: [IMP] mail, hr_holidays: use leaves to compute im_status When on leave, the im_status can be either leave_online or leave_offline. This will allow to display a specific icon and a default message when the user is not at the office. The leave can have an out of office message. This message will be displayed in the chat window instead of the user ooo message, and the end date of the leave will be displayed too. Technical details. Right now the im_status access leaves directly to know if a user is on leave or not. An index has been added to optimise this request (thanks to rco). A solution to optimise this would be to compute part of the information in a cron. Task: 1856205 --- .../js/thread_windows/abstract_thread_window.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'addons/mail/static/src/js/thread_windows/abstract_thread_window.js') diff --git a/addons/mail/static/src/js/thread_windows/abstract_thread_window.js b/addons/mail/static/src/js/thread_windows/abstract_thread_window.js index da958c1c5f1..300bfb11a3e 100644 --- a/addons/mail/static/src/js/thread_windows/abstract_thread_window.js +++ b/addons/mail/static/src/js/thread_windows/abstract_thread_window.js @@ -148,17 +148,23 @@ var AbstractThreadWindow = Widget.extend({ return this._thread; }, /** - * Get out of office user text + *Get out of office info * * @returns {string|undefined} */ - getOutOfOfficeMessage: function () { - if ( - !( - this.hasThread() && - this._thread.getType() === 'dm_chat' - ) - ) { + getOutOfOfficeInfo: function () { + if (!this.hasThread()) { + return undefined; + } + return this._thread.getOutOfOfficeInfo(); + }, + /** + * Get out of office user text + * + * @returns {string|undefined} + */ + getOutOfOfficeMessage: function () { + if (!this.hasThread()) { return undefined; } return this._thread.getOutOfOfficeMessage(); -- cgit v1.2.3