From f6e67650e8cb1f8f0be9e90dbaccf45692816c3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Tue, 22 Sep 2020 16:25:24 +0000 Subject: [FIX] mail: ignore `undefined` in JS fields create/write MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- addons/mail/static/src/models/thread/thread.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'addons/mail/static/src/models/thread/thread.js') diff --git a/addons/mail/static/src/models/thread/thread.js b/addons/mail/static/src/models/thread/thread.js index 5304130345e..a1818376233 100644 --- a/addons/mail/static/src/models/thread/thread.js +++ b/addons/mail/static/src/models/thread/thread.js @@ -3,6 +3,7 @@ odoo.define('mail/static/src/models/thread/thread.js', function (require) { const { registerNewModel } = require('mail/static/src/model/model_core.js'); const { attr, many2many, many2one, one2many, one2one } = require('mail/static/src/model/model_field.js'); +const { clear } = require('mail/static/src/model/model_field_command.js'); const throttle = require('mail/static/src/utils/throttle/throttle.js'); const Timer = require('mail/static/src/utils/timer/timer.js'); const mailUtils = require('mail.utils'); @@ -1235,7 +1236,7 @@ function factory(dependencies) { if ( this.serverFoldState === this.pendingFoldState ) { - this.update({ pendingFoldState: undefined }); + this.update({ pendingFoldState: clear() }); } if ( this.isPendingPinned !== undefined && @@ -1246,7 +1247,7 @@ function factory(dependencies) { if ( this.isServerPinned === this.isPendingPinned ) { - this.update({ isPendingPinned: undefined }); + this.update({ isPendingPinned: clear() }); } // TODO FIXME prevent to open/close a channel on mobile when you -- cgit v1.2.3