fix: use consistent moderator semantics

Use the same moderator semantics when adding items into the remote video menu as when showing/hiding the items themselves.
This commit is contained in:
Gabriel Imre 2020-07-21 11:26:26 +03:00 committed by Saúl Ibarra Corretgé
parent 9d6e21b77b
commit 1e3e15fc72
1 changed files with 8 additions and 3 deletions

View File

@ -3,9 +3,10 @@
import { openDialog } from '../../base/dialog';
import { IconCrown } from '../../base/icons';
import {
getLocalParticipant,
getParticipantById,
isLocalParticipantModerator,
isParticipantModerator
isParticipantModerator,
PARTICIPANT_ROLE
} from '../../base/participants';
import { AbstractButton } from '../../base/toolbox';
import type { AbstractButtonProps } from '../../base/toolbox';
@ -64,7 +65,11 @@ export default class AbstractGrantModeratorButton extends AbstractButton<Props,
export function _mapStateToProps(state: Object, ownProps: Props) {
const { participantID } = ownProps;
const localParticipant = getLocalParticipant(state);
const targetParticipant = getParticipantById(state, participantID);
return {
visible: isLocalParticipantModerator(state) && !isParticipantModerator(getParticipantById(state, participantID))
visible: Boolean(localParticipant?.role === PARTICIPANT_ROLE.MODERATOR)
&& !isParticipantModerator(targetParticipant)
};
}