Skip to content
Snippets Groups Projects
Commit ecb77c94 authored by tsm-odoo's avatar tsm-odoo
Browse files

[FIX] mail: fix push to talk key registration


Before this commit, the push to talk key was not correctly
captured. Indeed, Alt/Control/Shift/Meta was condifered
twice when present, resulting in an incorrect HotKey registration.

Steps to reproduce:
- Go a discuss channel
- Access the call setting menu
- Try to set your push to talk key to "Ctrl + Alt"
- The HotKey is incorrect ("Ctrl + Alt + Alt").

task-3058665

closes odoo/odoo#134248

Signed-off-by: default avatarAlexandre Kühn (aku) <aku@odoo.com>
parent db6d65a4
Branches
Tags
No related merge requests found
......@@ -110,7 +110,10 @@ function factory(dependencies) {
pushToTalkKeyToString() {
const { shiftKey, ctrlKey, altKey, key } = this.pushToTalkKeyFormat();
const f = (k, name) => k ? name : '';
return `${f(ctrlKey, 'Ctrl + ')}${f(altKey, 'Alt + ')}${f(shiftKey, 'Shift + ')}${key}`;
const keys = [f(ctrlKey, 'Ctrl'), f(altKey, 'Alt'), f(shiftKey, 'Shift'), key].filter(
Boolean
);
return keys.join(" + ");
}
/**
......@@ -139,7 +142,11 @@ function factory(dependencies) {
* @param {event} ev
*/
async setPushToTalkKey(ev) {
const pushToTalkKey = `${ev.shiftKey || ''}.${ev.ctrlKey || ev.metaKey || ''}.${ev.altKey || ''}.${ev.key}`;
const nonElligibleKeys = new Set(['Shift', 'Control', 'Alt', 'Meta']);
let pushToTalkKey = `${ev.shiftKey || ''}.${ev.ctrlKey || ev.metaKey || ''}.${ev.altKey || ''}`;
if (!nonElligibleKeys.has(ev.key)) {
pushToTalkKey += `.${ev.key === ' ' ? 'Space' : ev.key}`;
}
this.update({ pushToTalkKey });
if (!this.messaging.isCurrentUserGuest) {
this._saveSettings();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment