Kaynağa Gözat

feat: don’t render moderator icon if everyone is moderator

master
Bettenbuk Zoltan 6 yıl önce
ebeveyn
işleme
5101f69e4e

+ 19
- 0
react/features/base/participants/functions.js Dosyayı Görüntüle

@@ -260,6 +260,25 @@ function _getAllParticipants(stateful) {
260 260
             : toState(stateful)['features/base/participants'] || []);
261 261
 }
262 262
 
263
+/**
264
+ * Returns true if all of the meeting participants are moderators.
265
+ *
266
+ * @param {Object|Function} stateful -Object or function that can be resolved
267
+ * to the Redux state.
268
+ * @returns {boolean}
269
+ */
270
+export function isEveryoneModerator(stateful: Object | Function) {
271
+    const participants = _getAllParticipants(stateful);
272
+
273
+    for (const participant of participants) {
274
+        if (participant.role !== PARTICIPANT_ROLE.MODERATOR) {
275
+            return false;
276
+        }
277
+    }
278
+
279
+    return true;
280
+}
281
+
263 282
 /**
264 283
  * Returns true if the current local participant is a moderator in the
265 284
  * conference.

+ 9
- 1
react/features/filmstrip/components/native/Thumbnail.js Dosyayı Görüntüle

@@ -10,6 +10,7 @@ import { Audio, MEDIA_TYPE } from '../../../base/media';
10 10
 import {
11 11
     PARTICIPANT_ROLE,
12 12
     ParticipantView,
13
+    isEveryoneModerator,
13 14
     isLocalParticipantModerator,
14 15
     pinParticipant
15 16
 } from '../../../base/participants';
@@ -38,6 +39,11 @@ type Props = {
38 39
      */
39 40
     _audioTrack: Object,
40 41
 
42
+    /**
43
+     * True if everone in the meeting is moderator.
44
+     */
45
+    _isEveryoneModerator: boolean,
46
+
41 47
     /**
42 48
      * True if the local participant is a moderator.
43 49
      */
@@ -117,6 +123,7 @@ class Thumbnail extends Component<Props> {
117 123
     render() {
118 124
         const {
119 125
             _audioTrack: audioTrack,
126
+            _isEveryoneModerator,
120 127
             _isModerator,
121 128
             _largeVideo: largeVideo,
122 129
             _onClick,
@@ -172,7 +179,7 @@ class Thumbnail extends Component<Props> {
172 179
 
173 180
                 { renderDisplayName && <DisplayNameLabel participantId = { participantId } /> }
174 181
 
175
-                { participant.role === PARTICIPANT_ROLE.MODERATOR
182
+                { !_isEveryoneModerator && participant.role === PARTICIPANT_ROLE.MODERATOR
176 183
                     && <View style = { styles.moderatorIndicatorContainer }>
177 184
                         <ModeratorIndicator />
178 185
                     </View> }
@@ -275,6 +282,7 @@ function _mapStateToProps(state, ownProps) {
275 282
 
276 283
     return {
277 284
         _audioTrack: audioTrack,
285
+        _isEveryoneModerator: isEveryoneModerator(state),
278 286
         _isModerator: isLocalParticipantModerator(state),
279 287
         _largeVideo: largeVideo,
280 288
         _styles: ColorSchemeRegistry.get(state, 'Thumbnail'),

Loading…
İptal
Kaydet