fix(main-Toolbox): Display the correct buttons.

If some of the buttons from the main toolbar are disabled we were
displaying buttons from the overflow menu in their place.
This commit is contained in:
Hristo Terezov
2023-04-27 19:16:57 -05:00
parent e7db18bd80
commit be55ccd6f4

View File

@@ -1015,9 +1015,8 @@ class Toolbox extends Component<IProps> {
this._setButtonsNotifyClickMode(buttons);
const isHangupVisible = isToolbarButtonEnabled('hangup', _toolbarButtons);
const { order } = THRESHOLDS.find(({ width }) => _clientWidth > width)
let { order } = THRESHOLDS.find(({ width }) => _clientWidth > width)
|| THRESHOLDS[THRESHOLDS.length - 1];
let sliceIndex = order.length + 2;
const keys = Object.keys(buttons);
@@ -1028,6 +1027,11 @@ class Toolbox extends Component<IProps> {
!_jwtDisabledButons.includes(key)
&& (isToolbarButtonEnabled(key, _toolbarButtons) || isToolbarButtonEnabled(alias, _toolbarButtons))
);
const filteredKeys = filtered.map(button => button.key);
order = order.filter(key => filteredKeys.includes(buttons[key as keyof typeof buttons].key));
let sliceIndex = order.length + 2;
if (isHangupVisible) {
sliceIndex -= 1;