Compare commits

...

1 Commits

Author SHA1 Message Date
Horatiu Muresan 469f85fa46 fix(premeeting) Detach premeeting toolbar buttons visibility
- if hiddenPremeetingButtons is undefined, toolbarButtons overwrite decides what buttons to show
- if hiddenPremeetingButtons is empty array, all buttons are show on premeeting screen regardless of toolbarButtons
- if hiddenPremeetingButtons hides some buttons, only those buttons will be hidden regardless of toolbarButtons overwrite
2022-04-19 17:31:58 +03:00
2 changed files with 15 additions and 12 deletions

View File

@ -6,6 +6,7 @@ import { connect } from '../../../../base/redux';
import DeviceStatus from '../../../../prejoin/components/preview/DeviceStatus'; import DeviceStatus from '../../../../prejoin/components/preview/DeviceStatus';
import { Toolbox } from '../../../../toolbox/components/web'; import { Toolbox } from '../../../../toolbox/components/web';
import { PREMEETING_BUTTONS, THIRD_PARTY_PREJOIN_BUTTONS } from '../../../config/constants'; import { PREMEETING_BUTTONS, THIRD_PARTY_PREJOIN_BUTTONS } from '../../../config/constants';
import { getToolbarButtons, isToolbarButtonEnabled } from '../../../config/functions.web';
import ConnectionStatus from './ConnectionStatus'; import ConnectionStatus from './ConnectionStatus';
import Preview from './Preview'; import Preview from './Preview';
@ -147,14 +148,23 @@ class PreMeetingScreen extends PureComponent<Props> {
* @returns {Object} * @returns {Object}
*/ */
function mapStateToProps(state, ownProps): Object { function mapStateToProps(state, ownProps): Object {
const hideButtons = state['features/base/config'].hiddenPremeetingButtons || []; const { hiddenPremeetingButtons } = state['features/base/config'];
const premeetingButtons = ownProps.thirdParty const toolbarButtons = getToolbarButtons(state);
const premeetingButtons = (ownProps.thirdParty
? THIRD_PARTY_PREJOIN_BUTTONS ? THIRD_PARTY_PREJOIN_BUTTONS
: PREMEETING_BUTTONS; : PREMEETING_BUTTONS).filter(b => !(hiddenPremeetingButtons || []).includes(b));
const { premeetingBackground } = state['features/dynamic-branding']; const { premeetingBackground } = state['features/dynamic-branding'];
return { return {
_buttons: premeetingButtons.filter(b => !hideButtons.includes(b)), // For keeping backwards compat.: if we pass an empty hiddenPremeetingButtons
// array through external api, we have all prejoin buttons present on premeeting
// screen regardless of passed values into toolbarButtons config overwrite.
// If hiddenPremeetingButtons is missing, we hide the buttons according to
// toolbarButtons config overwrite.
_buttons: hiddenPremeetingButtons
? premeetingButtons
: premeetingButtons.filter(b => isToolbarButtonEnabled(b, toolbarButtons)),
_premeetingBackground: premeetingBackground _premeetingBackground: premeetingBackground
}; };
} }

View File

@ -1430,14 +1430,7 @@ function _mapStateToProps(state, ownProps) {
} }
} }
let { toolbarButtons } = ownProps; const toolbarButtons = ownProps.toolbarButtons || getToolbarButtons(state);
const stateToolbarButtons = getToolbarButtons(state);
if (toolbarButtons) {
toolbarButtons = toolbarButtons.filter(name => isToolbarButtonEnabled(name, stateToolbarButtons));
} else {
toolbarButtons = stateToolbarButtons;
}
return { return {
_backgroundType: state['features/virtual-background'].backgroundType, _backgroundType: state['features/virtual-background'].backgroundType,