From d7ece58c6fb64eff005e0dfd66b4aa2c1a91ed22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Wed, 4 Mar 2020 12:01:54 +0100 Subject: [PATCH] fix(optimise): cope with URL interface config overrides Regresssion from bd8a7edbd2f9e3058b67d39fdc1c78156902f995. When the toolbar buttons are overridden with URL parameters, our computed set of buttons will be wrong. Thus, compute it every time and check for the differences. --- react/features/filmstrip/components/web/Toolbar.js | 8 ++++++-- react/features/toolbox/components/web/Toolbox.js | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/react/features/filmstrip/components/web/Toolbar.js b/react/features/filmstrip/components/web/Toolbar.js index ecc0690fe1..4853bb1382 100644 --- a/react/features/filmstrip/components/web/Toolbar.js +++ b/react/features/filmstrip/components/web/Toolbar.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; -import { connect } from '../../../base/redux'; +import { connect, equals } from '../../../base/redux'; import { SettingsButton } from '../../../settings'; import { AudioMuteButton, @@ -88,9 +88,13 @@ class Toolbar extends Component { function _mapStateToProps(state): Object { // eslint-disable-line no-unused-vars // XXX: We are not currently using state here, but in the future, when // interfaceConfig is part of redux we will. + // + // NB: We compute the buttons again here because if URL parameters were used to + // override them we'd miss it. + const buttons = new Set(interfaceConfig.TOOLBAR_BUTTONS); return { - _visibleButtons: visibleButtons + _visibleButtons: equals(visibleButtons, buttons) ? visibleButtons : buttons }; } diff --git a/react/features/toolbox/components/web/Toolbox.js b/react/features/toolbox/components/web/Toolbox.js index 7dbcc47eb9..f960dec38a 100644 --- a/react/features/toolbox/components/web/Toolbox.js +++ b/react/features/toolbox/components/web/Toolbox.js @@ -28,7 +28,7 @@ import { getParticipants, participantUpdated } from '../../../base/participants'; -import { connect } from '../../../base/redux'; +import { connect, equals } from '../../../base/redux'; import { OverflowMenuItem } from '../../../base/toolbox'; import { getLocalVideoTrack, toggleScreensharing } from '../../../base/tracks'; import { VideoBlurButton } from '../../../blur'; @@ -1330,6 +1330,10 @@ function _mapStateToProps(state) { } } + // NB: We compute the buttons again here because if URL parameters were used to + // override them we'd miss it. + const buttons = new Set(interfaceConfig.TOOLBAR_BUTTONS); + return { _chatOpen: state['features/chat'].isOpen, _conference: conference, @@ -1351,7 +1355,7 @@ function _mapStateToProps(state) { || sharedVideoStatus === 'start' || sharedVideoStatus === 'pause', _visible: isToolboxVisible(state), - _visibleButtons: visibleButtons + _visibleButtons: equals(visibleButtons, buttons) ? visibleButtons : buttons }; }