rn: hide invite button if the functionality is not available

This commit is contained in:
Saúl Ibarra Corretgé 2019-07-02 11:06:26 +02:00 committed by Saúl Ibarra Corretgé
parent 72137a2811
commit 1baa85b649

View File

@ -12,12 +12,6 @@ import { isAddPeopleEnabled, isDialOutEnabled } from '../../../functions';
type Props = AbstractButtonProps & { type Props = AbstractButtonProps & {
/**
* Whether or not the feature to invite people to join the
* conference is available.
*/
_addPeopleEnabled: boolean,
/** /**
* The Redux dispatch function. * The Redux dispatch function.
*/ */
@ -42,16 +36,6 @@ class InviteButton extends AbstractButton<Props, *> {
_handleClick() { _handleClick() {
this.props.dispatch(setAddPeopleDialogVisible(true)); 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, *> {
* props. * props.
* *
* @param {Object} state - The redux store/state. * @param {Object} state - The redux store/state.
* @param {Object} ownProps - The properties explicitly passed to the component
* instance.
* @private * @private
* @returns {{ * @returns {Object}
* _addPeopleEnabled: boolean
* }}
*/ */
function _mapStateToProps(state) { function _mapStateToProps(state: Object, ownProps: Object) {
const addPeopleEnabled = isAddPeopleEnabled(state) || isDialOutEnabled(state);
const { visible = Boolean(addPeopleEnabled) } = ownProps;
return { return {
_addPeopleEnabled: isAddPeopleEnabled(state) || isDialOutEnabled(state) visible
}; };
} }