summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/models/chat_window
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2020-09-22 16:25:24 +0000
committerSébastien Theys <seb@odoo.com>2020-09-23 09:52:30 +0000
commitf6e67650e8cb1f8f0be9e90dbaccf45692816c3e (patch)
tree1e08313ef69bfe827c321161e05ac44e27c8ca8b /addons/mail/static/src/models/chat_window
parentbc00059bcd1c6475b00503e9242edd6547dbd93d (diff)
[FIX] mail: ignore `undefined` in JS fields create/write
Passing a field containing `undefined` should lead to the same result as not passing the field. Fields that relied on `undefined` as a value have been changed to use the newly introduced `clear` command, that resets a field to its default value (often that is equal to `undefined`). task-2336491 closes odoo/odoo#58308 X-original-commit: b18824485483564d2ab80f41914a3548aa528ae0 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/models/chat_window')
-rw-r--r--addons/mail/static/src/models/chat_window/chat_window.js25
1 files changed, 4 insertions, 21 deletions
diff --git a/addons/mail/static/src/models/chat_window/chat_window.js b/addons/mail/static/src/models/chat_window/chat_window.js
index 5efcaf3b6fe..a197481037c 100644
--- a/addons/mail/static/src/models/chat_window/chat_window.js
+++ b/addons/mail/static/src/models/chat_window/chat_window.js
@@ -3,6 +3,7 @@ odoo.define('mail/static/src/models/chat_window/chat_window.js', function (requi
const { registerNewModel } = require('mail/static/src/model/model_core.js');
const { attr, many2one, one2many, one2one } = require('mail/static/src/model/model_field.js');
+const { clear } = require('mail/static/src/model/model_field_command.js');
function factory(dependencies) {
@@ -193,14 +194,6 @@ function factory(dependencies) {
* @returns {boolean}
*/
_computeIsVisible() {
- return this.manager.allOrderedVisible.includes(this);
- }
-
- /**
- * @private
- * @returns {boolean}
- */
- _computeIsVisible() {
if (!this.manager) {
return false;
}
@@ -224,12 +217,12 @@ function factory(dependencies) {
*/
_computeVisibleIndex() {
if (!this.manager) {
- return undefined;
+ return clear();
}
const visible = this.manager.visual.visible;
const index = visible.findIndex(visible => visible.chatWindowLocalId === this.localId);
if (index === -1) {
- return undefined;
+ return clear();
}
return index;
}
@@ -383,17 +376,7 @@ function factory(dependencies) {
default: false,
}),
/**
- * States whether `this` is visible or not.
- */
- isVisible: attr({
- compute: '_computeIsVisible',
- dependencies: [
- 'managerAllOrderedVisible',
- ],
- default: false,
- }),
- /**
- * Whether this chat window is visible or not. Should be considered
+ * States whether `this` is visible or not. Should be considered
* read-only. Setting this value manually will not make it visible.
* @see `makeVisible`
*/