From 5101f69e4ed3d128cb6b2b85d830dd24ea34e0d2 Mon Sep 17 00:00:00 2001 From: Bettenbuk Zoltan Date: Wed, 22 May 2019 12:00:17 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20don=E2=80=99t=20render=20moderator=20ic?= =?UTF-8?q?on=20if=20everyone=20is=20moderator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react/features/base/participants/functions.js | 19 +++++++++++++++++++ .../filmstrip/components/native/Thumbnail.js | 10 +++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/react/features/base/participants/functions.js b/react/features/base/participants/functions.js index 1a73a75b8..10f5c873b 100644 --- a/react/features/base/participants/functions.js +++ b/react/features/base/participants/functions.js @@ -260,6 +260,25 @@ function _getAllParticipants(stateful) { : 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 * conference. diff --git a/react/features/filmstrip/components/native/Thumbnail.js b/react/features/filmstrip/components/native/Thumbnail.js index c6d639303..6aa4b0eb0 100644 --- a/react/features/filmstrip/components/native/Thumbnail.js +++ b/react/features/filmstrip/components/native/Thumbnail.js @@ -10,6 +10,7 @@ import { Audio, MEDIA_TYPE } from '../../../base/media'; import { PARTICIPANT_ROLE, ParticipantView, + isEveryoneModerator, isLocalParticipantModerator, pinParticipant } from '../../../base/participants'; @@ -38,6 +39,11 @@ type Props = { */ _audioTrack: Object, + /** + * True if everone in the meeting is moderator. + */ + _isEveryoneModerator: boolean, + /** * True if the local participant is a moderator. */ @@ -117,6 +123,7 @@ class Thumbnail extends Component { render() { const { _audioTrack: audioTrack, + _isEveryoneModerator, _isModerator, _largeVideo: largeVideo, _onClick, @@ -172,7 +179,7 @@ class Thumbnail extends Component { { renderDisplayName && } - { participant.role === PARTICIPANT_ROLE.MODERATOR + { !_isEveryoneModerator && participant.role === PARTICIPANT_ROLE.MODERATOR && } @@ -275,6 +282,7 @@ function _mapStateToProps(state, ownProps) { return { _audioTrack: audioTrack, + _isEveryoneModerator: isEveryoneModerator(state), _isModerator: isLocalParticipantModerator(state), _largeVideo: largeVideo, _styles: ColorSchemeRegistry.get(state, 'Thumbnail'),