diff options
| author | Robot Odoo <xmo+roboto@odoo.com> | 2019-02-11 12:57:48 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-11 12:57:48 +0100 |
| commit | 47bb7ef7968cb3c5c11f767df06fcf09333a2b13 (patch) | |
| tree | 1e86b27e45fe2b5803294e886227495fdd68a96b /addons/mail/static/src/js/thread_windows | |
| parent | 768844040f887868759309ad101fe50191fc949a (diff) | |
| parent | 975164473ccd51c00eee5917dddbd8be71b5aefc (diff) | |
[MERGE] mail, hr_holidays, *: add out of office status
*: base, bus, mail_bot, test_mail
Before this task, it was not easy to tell when a user is not available (or is on holiday)
from conversations, such as from chat windows.
With this task, a user can now tell that he is out-of-office from the user menu preferences,
by defining an an out-of-office message. This information will be displayed to other users from
chat conversations and mention suggestions (i.e. with `@`).
Also, the computation of the user `im_status` has been changed when he has an active leave:
an out-of-office message can be set on the leave, and this will be displayed on conversations
instead of the user's out-of-office message from the user menu preferences.
Task: 1856205
closes odoo/odoo#29974
Diffstat (limited to 'addons/mail/static/src/js/thread_windows')
| -rw-r--r-- | addons/mail/static/src/js/thread_windows/abstract_thread_window.js | 22 | ||||
| -rw-r--r-- | addons/mail/static/src/js/thread_windows/thread_window.js | 24 |
2 files changed, 46 insertions, 0 deletions
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..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,6 +148,28 @@ var AbstractThreadWindow = Widget.extend({ return this._thread; }, /** + *Get out of office info + * + * @returns {string|undefined} + */ + 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(); + }, + /** * 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 * `undefined`. 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 331228c91c8..41b0ef6d36c 100644 --- a/addons/mail/static/src/js/thread_windows/thread_window.js +++ b/addons/mail/static/src/js/thread_windows/thread_window.js @@ -21,6 +21,7 @@ var ThreadWindow = AbstractThreadWindow.extend({ 'click .o_mail_thread': '_onThreadWindowFocus', 'click .o_thread_composer': '_onThreadWindowFocus', 'click .o_thread_window_expand': '_onClickExpand', + 'click .o_out_of_office_read_more_less_button': '_onClickOutOfOfficeReadMoreLess', }), /** * Version of thread window that supports {mail.model.Thread} @@ -80,6 +81,7 @@ var ThreadWindow = AbstractThreadWindow.extend({ self.$input = self.$('.o_composer_text_field'); }); } + this._updateOutOfOfficeReadMoreLessButton(); return $.when(superDef, composerDef); }, @@ -250,6 +252,19 @@ var ThreadWindow = AbstractThreadWindow.extend({ }) .focus(); }, + /** + * @private + */ + _updateOutOfOfficeReadMoreLessButton: function () { + var $readMore = this.$('.o_out_of_office_text'); + var isOverflowing = $readMore.prop('scrollWidth') > $readMore.width(); + var isOverflowShown = !$readMore.hasClass('o_text_wrap'); + if (isOverflowing || isOverflowShown) { + var $button = this.$('.o_out_of_office_read_more_less_button'); + $button.show(); + $button.text(isOverflowing ? _t('Read more') : _t('Read less')); + } + }, //-------------------------------------------------------------------------- // Handlers @@ -289,6 +304,15 @@ var ThreadWindow = AbstractThreadWindow.extend({ } }, 1000, true), /** + * @private + * @param {MouseEvent} ev + */ + _onClickOutOfOfficeReadMoreLess: function (ev) { + ev.preventDefault(); + this.$('.o_out_of_office_text').toggleClass('o_text_wrap'); + this._updateOutOfOfficeReadMoreLessButton(); + }, + /** * @override * @private * @param {KeyboardEvent} ev |
