From 1baa85b649ba184dba0049d0b0fea273956b9d26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Tue, 2 Jul 2019 11:06:26 +0200 Subject: [PATCH] rn: hide invite button if the functionality is not available --- .../add-people-dialog/native/InviteButton.js | 29 +++++-------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/react/features/invite/components/add-people-dialog/native/InviteButton.js b/react/features/invite/components/add-people-dialog/native/InviteButton.js index 06d1b810f..2dfafecf2 100644 --- a/react/features/invite/components/add-people-dialog/native/InviteButton.js +++ b/react/features/invite/components/add-people-dialog/native/InviteButton.js @@ -12,12 +12,6 @@ import { isAddPeopleEnabled, isDialOutEnabled } from '../../../functions'; type Props = AbstractButtonProps & { - /** - * Whether or not the feature to invite people to join the - * conference is available. - */ - _addPeopleEnabled: boolean, - /** * The Redux dispatch function. */ @@ -42,16 +36,6 @@ class InviteButton extends AbstractButton { _handleClick() { this.props.dispatch(setAddPeopleDialogVisible(true)); } - - /** - * Returns true if none of the invite methods are available. - * - * @protected - * @returns {boolean} - */ - _isDisabled() { - return !this.props._addPeopleEnabled; - } } /** @@ -59,14 +43,17 @@ class InviteButton extends AbstractButton { * props. * * @param {Object} state - The redux store/state. + * @param {Object} ownProps - The properties explicitly passed to the component + * instance. * @private - * @returns {{ - * _addPeopleEnabled: boolean - * }} + * @returns {Object} */ -function _mapStateToProps(state) { +function _mapStateToProps(state: Object, ownProps: Object) { + const addPeopleEnabled = isAddPeopleEnabled(state) || isDialOutEnabled(state); + const { visible = Boolean(addPeopleEnabled) } = ownProps; + return { - _addPeopleEnabled: isAddPeopleEnabled(state) || isDialOutEnabled(state) + visible }; }