diff options
| author | Alexandre Kühn <aku@odoo.com> | 2019-08-27 10:13:11 +0000 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2019-08-27 14:51:28 +0000 |
| commit | 75e8342e81c501c80beaad3650142823edaadca2 (patch) | |
| tree | 418879bf21bd3c6cb15452267f828659ea5d72ba /addons/mail/static/src/js/thread_windows/thread_window.js | |
| parent | decd9968d3fefc6784879fe250e5dd187335627e (diff) | |
[FIX] mail: composer in mass_mailing channel (mobile)
Before this commit, a channel in mobile with option "Send messages
by email" had no composer when opening in mobile.
This issue happened because channel views in mobile are in fact chat
windows. Chat windows with such channels do no display any composer,
which is intended in desktop.
This commit fixes the issue by enabling the extended composer for
chat windows with email channels, just for mobile.
opw-2059468
closes odoo/odoo#36120
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
Diffstat (limited to 'addons/mail/static/src/js/thread_windows/thread_window.js')
| -rw-r--r-- | addons/mail/static/src/js/thread_windows/thread_window.js | 44 |
1 files changed, 18 insertions, 26 deletions
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 49f4abf7f06..1840e1802cc 100644 --- a/addons/mail/static/src/js/thread_windows/thread_window.js +++ b/addons/mail/static/src/js/thread_windows/thread_window.js @@ -3,7 +3,9 @@ odoo.define('mail.ThreadWindow', function (require) { var AbstractThreadWindow = require('mail.AbstractThreadWindow'); var BasicComposer = require('mail.composer.Basic'); +var ExtendedComposer = require('mail.composer.Extended'); +var config = require('web.config'); var core = require('web.core'); var _t = core._t; @@ -59,19 +61,27 @@ var ThreadWindow = AbstractThreadWindow.extend({ if (!this.hasThread()) { this._startWithoutThread(); } else if (this.needsComposer()) { - var basicComposer = new BasicComposer(this, { + var composer; + var composerParams = { mentionPartnersRestricted: this._thread.getType() !== 'document_thread', - isMini: true, thread: this._thread, - }); - basicComposer.on('post_message', this, this._postMessage); - basicComposer.once('input_focused', this, function () { + }; + if ( + config.device.isMobile && + this._thread.isMassMailing() + ) { + composer = new ExtendedComposer(this, composerParams); + } else { + composer = new BasicComposer(this, _.extend({ isMini: true }, composerParams)); + } + composer.on('post_message', this, this._postMessage); + composer.once('input_focused', this, function () { var commands = this._thread.getCommands(); var partners = this._thread.getMentionPartnerSuggestions(); - basicComposer.mentionSetCommands(commands); - basicComposer.mentionSetPrefetchedPartners(partners); + composer.mentionSetCommands(commands); + composer.mentionSetPrefetchedPartners(partners); }); - composerDef = basicComposer.replace(this.$('.o_thread_composer')); + composerDef = composer.replace(this.$('.o_thread_composer')); composerDef.then(function () { self.$input = self.$('.o_composer_text_field'); }); @@ -123,24 +133,6 @@ var ThreadWindow = AbstractThreadWindow.extend({ return this._passive; }, /** - * States whether the input of the thread window should be displayed or not. - * This is based on the type of the thread: - * - * Do not display the input in the following cases: - * - * - no thread related to this window - * - window of a mailbox (temp: let us have mailboxes in window mode) - * - window of a thread with mass mailing - * - * Any other threads show the input in the window. - * - * @override - * @returns {boolean} - */ - needsComposer: function () { - return this._super() && !this._thread.isMassMailing(); - }, - /** * Turn the thread window in active mode, so that when the bottom of the * thread is visible, it is automatically marked as read. */ |
