feat: don’t render moderator icon if everyone is moderator
This commit is contained in:
parent
61b66e0edf
commit
5101f69e4e
|
@ -260,6 +260,25 @@ function _getAllParticipants(stateful) {
|
||||||
: toState(stateful)['features/base/participants'] || []);
|
: toState(stateful)['features/base/participants'] || []);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if all of the meeting participants are moderators.
|
||||||
|
*
|
||||||
|
* @param {Object|Function} stateful -Object or function that can be resolved
|
||||||
|
* to the Redux state.
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
export function isEveryoneModerator(stateful: Object | Function) {
|
||||||
|
const participants = _getAllParticipants(stateful);
|
||||||
|
|
||||||
|
for (const participant of participants) {
|
||||||
|
if (participant.role !== PARTICIPANT_ROLE.MODERATOR) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the current local participant is a moderator in the
|
* Returns true if the current local participant is a moderator in the
|
||||||
* conference.
|
* conference.
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { Audio, MEDIA_TYPE } from '../../../base/media';
|
||||||
import {
|
import {
|
||||||
PARTICIPANT_ROLE,
|
PARTICIPANT_ROLE,
|
||||||
ParticipantView,
|
ParticipantView,
|
||||||
|
isEveryoneModerator,
|
||||||
isLocalParticipantModerator,
|
isLocalParticipantModerator,
|
||||||
pinParticipant
|
pinParticipant
|
||||||
} from '../../../base/participants';
|
} from '../../../base/participants';
|
||||||
|
@ -38,6 +39,11 @@ type Props = {
|
||||||
*/
|
*/
|
||||||
_audioTrack: Object,
|
_audioTrack: Object,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True if everone in the meeting is moderator.
|
||||||
|
*/
|
||||||
|
_isEveryoneModerator: boolean,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True if the local participant is a moderator.
|
* True if the local participant is a moderator.
|
||||||
*/
|
*/
|
||||||
|
@ -117,6 +123,7 @@ class Thumbnail extends Component<Props> {
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
_audioTrack: audioTrack,
|
_audioTrack: audioTrack,
|
||||||
|
_isEveryoneModerator,
|
||||||
_isModerator,
|
_isModerator,
|
||||||
_largeVideo: largeVideo,
|
_largeVideo: largeVideo,
|
||||||
_onClick,
|
_onClick,
|
||||||
|
@ -172,7 +179,7 @@ class Thumbnail extends Component<Props> {
|
||||||
|
|
||||||
{ renderDisplayName && <DisplayNameLabel participantId = { participantId } /> }
|
{ renderDisplayName && <DisplayNameLabel participantId = { participantId } /> }
|
||||||
|
|
||||||
{ participant.role === PARTICIPANT_ROLE.MODERATOR
|
{ !_isEveryoneModerator && participant.role === PARTICIPANT_ROLE.MODERATOR
|
||||||
&& <View style = { styles.moderatorIndicatorContainer }>
|
&& <View style = { styles.moderatorIndicatorContainer }>
|
||||||
<ModeratorIndicator />
|
<ModeratorIndicator />
|
||||||
</View> }
|
</View> }
|
||||||
|
@ -275,6 +282,7 @@ function _mapStateToProps(state, ownProps) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
_audioTrack: audioTrack,
|
_audioTrack: audioTrack,
|
||||||
|
_isEveryoneModerator: isEveryoneModerator(state),
|
||||||
_isModerator: isLocalParticipantModerator(state),
|
_isModerator: isLocalParticipantModerator(state),
|
||||||
_largeVideo: largeVideo,
|
_largeVideo: largeVideo,
|
||||||
_styles: ColorSchemeRegistry.get(state, 'Thumbnail'),
|
_styles: ColorSchemeRegistry.get(state, 'Thumbnail'),
|
||||||
|
|
Loading…
Reference in New Issue