summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/models/composer
diff options
context:
space:
mode:
authorXavier Dubuc <xdu@odoo.com>2020-10-09 13:50:45 +0000
committerXavier Dubuc <xdu@odoo.com>2020-10-29 11:45:42 +0000
commitecb56a6893dd7b76402c2262fb93f8dea079fde0 (patch)
tree1dd18589fbdbbb1efbba2a300fddaaae5fb49385 /addons/mail/static/src/models/composer
parent1525dc7e4481cf9e24e6c5fff9a73df874670c97 (diff)
[FIX] mail: fix handling of lastVisibleMessage in channel seen condition
also fix a problem with composer.hasFocus field not always correctly updated (e.g. when switching from a channel to another in discuss) task-2278915 closes odoo/odoo#60079 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/models/composer')
-rw-r--r--addons/mail/static/src/models/composer/composer.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/addons/mail/static/src/models/composer/composer.js b/addons/mail/static/src/models/composer/composer.js
index 25052fd1b38..0a1d817466e 100644
--- a/addons/mail/static/src/models/composer/composer.js
+++ b/addons/mail/static/src/models/composer/composer.js
@@ -103,6 +103,21 @@ function factory(dependencies) {
}
/**
+ * Focus this composer and remove focus from all others.
+ * Focus is a global concern, it makes no sense to have multiple composers focused at the
+ * same time.
+ */
+ focus() {
+ const allComposers = this.env.models['mail.composer'].all();
+ for (const otherComposer of allComposers) {
+ if (otherComposer !== this && otherComposer.hasFocus) {
+ otherComposer.update({ hasFocus: false });
+ }
+ }
+ this.update({ hasFocus: true });
+ }
+
+ /**
* Inserts text content in text input based on selection.
*
* @param {string} content