Skip to content
Snippets Groups Projects
Commit 557bb28c authored by Thanh Dodeur's avatar Thanh Dodeur Committed by Alexandre Kühn
Browse files

[FIX] mail: ensure that voice threshold is updated across tabs


Before this commit, updating the voice activation threshold in one tab
would not affect the other tabs as the localStorage was only read when
discuss was initialized.

This commit fixes this issue.

task-2679234

closes odoo/odoo#88154

X-original-commit: 80c81c70787952eb4fdc4b81210bdf2893210e1a
Signed-off-by: default avatarAlexandre Kühn (aku) <aku@odoo.com>
parent 71050fb0
Branches
Tags
No related merge requests found
/** @odoo-module **/
import { browser } from "@web/core/browser/browser";
import { registerModel } from '@mail/model/model_core';
import { attr, many, one } from '@mail/model/model_field';
import { clear, insertAndReplace } from '@mail/model/model_field_command';
......@@ -10,8 +12,10 @@ registerModel({
lifecycleHooks: {
_created() {
this._loadLocalSettings();
browser.addEventListener('storage', this._onStorage);
},
_willDelete() {
browser.removeEventListener('storage', this._onStorage);
for (const timeout of Object.values(this.volumeSettingsTimeouts)) {
this.messaging.browser.clearTimeout(timeout);
}
......@@ -183,6 +187,16 @@ registerModel({
});
}
},
/**
* @private
* @param {Event} ev
*/
async _onStorage(ev) {
if (ev.key === 'mail_user_setting_voice_threshold') {
this.update({ voiceActivationThreshold: ev.newValue });
await this.messaging.rtc.updateVoiceActivation();
}
},
/**
* @private
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment