fix(toolbox) fix displaying mute everyone buttons for non-moderators

This commit is contained in:
Saúl Ibarra Corretgé 2021-05-12 14:06:09 +02:00 committed by Дамян Минков
parent fe22e33343
commit 47c9e14155
2 changed files with 6 additions and 20 deletions

View File

@ -4,7 +4,7 @@ import { createToolbarEvent, sendAnalytics } from '../../analytics';
import { openDialog } from '../../base/dialog';
import { translate } from '../../base/i18n';
import { IconMuteEveryone } from '../../base/icons';
import { getLocalParticipant, PARTICIPANT_ROLE } from '../../base/participants';
import { getLocalParticipant, isLocalParticipantModerator } from '../../base/participants';
import { connect } from '../../base/redux';
import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox/components';
import { MuteEveryoneDialog } from '../../video-menu/components';
@ -16,11 +16,6 @@ type Props = AbstractButtonProps & {
*/
dispatch: Function,
/*
** Whether the local participant is a moderator or not.
*/
isModerator: Boolean,
/**
* The ID of the local participant.
*/
@ -61,14 +56,12 @@ class MuteEveryoneButton extends AbstractButton<Props, *> {
*/
function _mapStateToProps(state: Object, ownProps: Props) {
const localParticipant = getLocalParticipant(state);
const isModerator = localParticipant.role === PARTICIPANT_ROLE.MODERATOR;
const { visible } = ownProps;
const { disableRemoteMute } = state['features/base/config'];
const { visible = isLocalParticipantModerator(state) && !disableRemoteMute } = ownProps;
return {
isModerator,
localParticipantId: localParticipant.id,
visible: visible && isModerator && !disableRemoteMute
visible
};
}

View File

@ -4,7 +4,7 @@ import { createToolbarEvent, sendAnalytics } from '../../analytics';
import { openDialog } from '../../base/dialog';
import { translate } from '../../base/i18n';
import { IconMuteVideoEveryone } from '../../base/icons';
import { getLocalParticipant, PARTICIPANT_ROLE } from '../../base/participants';
import { getLocalParticipant, isLocalParticipantModerator } from '../../base/participants';
import { connect } from '../../base/redux';
import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox/components';
import { MuteEveryonesVideoDialog } from '../../video-menu/components';
@ -16,11 +16,6 @@ type Props = AbstractButtonProps & {
*/
dispatch: Function,
/*
** Whether the local participant is a moderator or not.
*/
isModerator: Boolean,
/**
* The ID of the local participant.
*/
@ -61,14 +56,12 @@ class MuteEveryonesVideoButton extends AbstractButton<Props, *> {
*/
function _mapStateToProps(state: Object, ownProps: Props) {
const localParticipant = getLocalParticipant(state);
const isModerator = localParticipant.role === PARTICIPANT_ROLE.MODERATOR;
const { visible } = ownProps;
const { disableRemoteMute } = state['features/base/config'];
const { visible = isLocalParticipantModerator(state) && !disableRemoteMute } = ownProps;
return {
isModerator,
localParticipantId: localParticipant.id,
visible: visible && isModerator && !disableRemoteMute
visible
};
}