From 841373e2c4633a4e47c7b2e5812e86cc2033852a Mon Sep 17 00:00:00 2001 From: Thanh Dodeur Date: Wed, 13 Apr 2022 09:04:03 +0000 Subject: [PATCH] [FIX] mail: prevent incorrect loading of settings from the localstorage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, the settings recovered from the localStorage were incorrectly loaded to the model fields. This commit fixes this issue. taskId-2823292 closes odoo/odoo#88828 X-original-commit: 5b429e54b732257075e0925211e9ab9b0b827ca1 Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/models/user_setting.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/addons/mail/static/src/models/user_setting.js b/addons/mail/static/src/models/user_setting.js index 99b63d67815..7fc6ca20886 100644 --- a/addons/mail/static/src/models/user_setting.js +++ b/addons/mail/static/src/models/user_setting.js @@ -179,13 +179,10 @@ registerModel({ const audioInputDeviceId = this.env.services.local_storage.getItem( "mail_user_setting_audio_input_device_id" ); - const voiceActivationThreshold = parseFloat(voiceActivationThresholdString); - if (voiceActivationThreshold > 0) { - this.update({ - voiceActivationThreshold, - audioInputDeviceId, - }); - } + this.update({ + voiceActivationThreshold: voiceActivationThresholdString ? parseFloat(voiceActivationThresholdString) : undefined, + audioInputDeviceId: audioInputDeviceId || undefined, + }); }, /** * @private