diff options
Diffstat (limited to 'addons/mail/static/src/js')
3 files changed, 13 insertions, 3 deletions
diff --git a/addons/mail/static/src/js/services/mail_window_manager.js b/addons/mail/static/src/js/services/mail_window_manager.js index de614ba705f..79ea668e55e 100644 --- a/addons/mail/static/src/js/services/mail_window_manager.js +++ b/addons/mail/static/src/js/services/mail_window_manager.js @@ -641,7 +641,7 @@ MailManager.include({ */ _onNewChannel: function (channel) { if (channel.isDetached()) { - this.openThreadWindow(channel.getID(), { keepFoldState: true }); + this.openThreadWindow(channel.getID(), { keepFoldState: true, passively: true }); } else { this._closeThreadWindow(channel.getID()); } 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 8a8bf3a0077..801a8166787 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 @@ -350,6 +350,16 @@ var AbstractThreadWindow = Widget.extend({ return this._thread.getID(); }, /** + * Tells whether there is focus on this thread. Note that a thread that has + * the focus means the input has focus. + * + * @private + * @returns {boolean} + */ + _hasFocus: function () { + return this.$input.is(':focus'); + }, + /** * Post a message on this thread window, and auto-scroll to the bottom of * the thread. * 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 20c0965205e..86cb3419eb9 100644 --- a/addons/mail/static/src/js/thread_windows/thread_window.js +++ b/addons/mail/static/src/js/thread_windows/thread_window.js @@ -164,11 +164,11 @@ var ThreadWindow = AbstractThreadWindow.extend({ * should scroll to the bottom if it was at the bottom before update * @param {boolean} [options.passively=false] if set, this thread window * becomes passive, so that it is marked as read only when the focus is - * on it. + * on it. Ignore this option if the focus is already on the thread window. */ update: function (options) { var self = this; - if (options.passively) { + if (options.passively && !this._hasFocus()) { this._setPassive(); } var bottomVisible = !this.isFolded() && |
