Skip to content

Commit

Permalink
Disable kick participant button for guests
Browse files Browse the repository at this point in the history
  • Loading branch information
horymury authored and saghul committed Mar 18, 2020
1 parent 011b7f9 commit d0bc3da
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
5 changes: 5 additions & 0 deletions interface_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
27 changes: 25 additions & 2 deletions react/features/remote-video-menu/components/web/KickButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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));

0 comments on commit d0bc3da

Please sign in to comment.