Disable kick participant button for guests

This commit is contained in:
Horatiu Muresan 2020-03-18 15:58:16 +02:00 committed by Saúl Ibarra Corretgé
parent 011b7f9d00
commit d0bc3da0f5
2 changed files with 30 additions and 2 deletions

View File

@ -208,6 +208,11 @@ var interfaceConfig = {
*/
SHOW_CHROME_EXTENSION_BANNER: false
/**
* When enabled, the kick participant button will not be presented for users without a JWT
*/
// HIDE_KICK_BUTTON_FOR_GUESTS: false
/**
* How many columns the tile view can expand to. The respected range is
* between 1 and 5.

View File

@ -12,6 +12,8 @@ import AbstractKickButton, {
import RemoteVideoMenuButton from './RemoteVideoMenuButton';
declare var interfaceConfig: Object;
/**
* Implements a React {@link Component} which displays a button for kicking out
* a participant from the conference.
@ -41,7 +43,11 @@ class KickButton extends AbstractKickButton {
* @returns {ReactElement}
*/
render() {
const { participantID, t } = this.props;
const { participantID, t, visible } = this.props;
if (!visible) {
return null;
}
return (
<RemoteVideoMenuButton
@ -57,4 +63,21 @@ class KickButton extends AbstractKickButton {
_handleClick: () => void
}
export default translate(connect()(KickButton));
/**
* Maps (parts of) the redux state to {@link KickButton}'s React {@code Component}
* props.
*
* @param {Object} state - The redux store/state.
* @private
* @returns {Object}
*/
function _mapStateToProps(state: Object) {
const shouldHide = interfaceConfig.HIDE_KICK_BUTTON_FOR_GUESTS && state['features/base/jwt'].isGuest;
return {
visible: !shouldHide
};
}
export default translate(connect(_mapStateToProps)(KickButton));