瀏覽代碼

fix(av-moderation) Check for moderation support

Show av moderation toggles on mute all / stop everyone's video dialogs only if moderation is supported
Show Ask to Unmute only for moderators
master
robertpin 3 年之前
父節點
當前提交
1beed8c490

+ 4
- 1
react/features/participants-pane/components/ParticipantQuickAction.js 查看文件

@@ -63,12 +63,15 @@ export default function ParticipantQuickAction({
63 63
             </QuickActionButton>
64 64
         );
65 65
     }
66
-    default: {
66
+    case QUICK_ACTION_BUTTON.ASK_TO_UNMUTE: {
67 67
         return (
68 68
             <AskToUnmuteButton
69 69
                 askUnmuteText = { askUnmuteText }
70 70
                 participantID = { participantID } />
71 71
         );
72 72
     }
73
+    default: {
74
+        return null;
75
+    }
73 76
     }
74 77
 }

+ 24
- 2
react/features/participants-pane/components/web/MeetingParticipantItem.js 查看文件

@@ -2,6 +2,7 @@
2 2
 
3 3
 import React, { useCallback, useEffect, useState } from 'react';
4 4
 
5
+import { isSupported } from '../../../av-moderation/functions';
5 6
 import { translate } from '../../../base/i18n';
6 7
 import { JitsiTrackEvents } from '../../../base/lib-jitsi-meet';
7 8
 import { MEDIA_TYPE } from '../../../base/media';
@@ -9,6 +10,7 @@ import {
9 10
     getLocalParticipant,
10 11
     getParticipantByIdOrUndefined,
11 12
     getParticipantDisplayName,
13
+    isLocalParticipantModerator,
12 14
     isParticipantModerator
13 15
 } from '../../../base/participants';
14 16
 import { connect } from '../../../base/redux';
@@ -18,7 +20,7 @@ import {
18 20
     isParticipantAudioMuted,
19 21
     isParticipantVideoMuted
20 22
 } from '../../../base/tracks';
21
-import { ACTION_TRIGGER, type MediaState, MEDIA_STATE } from '../../constants';
23
+import { ACTION_TRIGGER, type MediaState, MEDIA_STATE, QUICK_ACTION_BUTTON } from '../../constants';
22 24
 import {
23 25
     getParticipantAudioMediaState,
24 26
     getParticipantVideoMediaState,
@@ -51,11 +53,21 @@ type Props = {
51 53
      */
52 54
     _displayName: string,
53 55
 
56
+    /**
57
+     * Whether or not moderation is supported.
58
+     */
59
+    _isModerationSupported: boolean,
60
+
54 61
     /**
55 62
      * True if the participant is the local participant.
56 63
      */
57 64
     _local: Boolean,
58 65
 
66
+    /**
67
+     * Whether or not the local participant is moderator.
68
+     */
69
+    _localModerator: boolean,
70
+
59 71
     /**
60 72
      * Shared video local participant owner.
61 73
      */
@@ -162,7 +174,9 @@ function MeetingParticipantItem({
162 174
     _audioTrack,
163 175
     _disableModeratorIndicator,
164 176
     _displayName,
177
+    _isModerationSupported,
165 178
     _local,
179
+    _localModerator,
166 180
     _localVideoOwner,
167 181
     _participant,
168 182
     _participantID,
@@ -220,6 +234,10 @@ function MeetingParticipantItem({
220 234
         askToUnmuteText = t('participantsPane.actions.allowVideo');
221 235
     }
222 236
 
237
+    const buttonType = _isModerationSupported
238
+        ? _localModerator ? QUICK_ACTION_BUTTON.ASK_TO_UNMUTE : _quickActionButtonType
239
+        : '';
240
+
223 241
     return (
224 242
         <ParticipantItem
225 243
             actionsTrigger = { ACTION_TRIGGER.HOVER }
@@ -241,7 +259,7 @@ function MeetingParticipantItem({
241 259
                 && <>
242 260
                     <ParticipantQuickAction
243 261
                         askUnmuteText = { askToUnmuteText }
244
-                        buttonType = { _quickActionButtonType }
262
+                        buttonType = { buttonType }
245 263
                         muteAudio = { muteAudio }
246 264
                         muteParticipantButtonText = { muteParticipantButtonText }
247 265
                         participantID = { _participantID } />
@@ -287,12 +305,16 @@ function _mapStateToProps(state, ownProps): Object {
287 305
 
288 306
     const { disableModeratorIndicator } = state['features/base/config'];
289 307
 
308
+    const _localModerator = isLocalParticipantModerator(state);
309
+
290 310
     return {
291 311
         _audioMediaState,
292 312
         _audioTrack,
293 313
         _disableModeratorIndicator: disableModeratorIndicator,
294 314
         _displayName: getParticipantDisplayName(state, participant?.id),
315
+        _isModerationSupported: isSupported()(state),
295 316
         _local: Boolean(participant?.local),
317
+        _localModerator,
296 318
         _localVideoOwner: Boolean(ownerId === localParticipantId),
297 319
         _participant: participant,
298 320
         _participantID: participant?.id,

+ 5
- 3
react/features/video-menu/components/AbstractMuteEveryoneDialog.js 查看文件

@@ -3,7 +3,7 @@
3 3
 import React from 'react';
4 4
 
5 5
 import { requestDisableAudioModeration, requestEnableAudioModeration } from '../../av-moderation/actions';
6
-import { isEnabledFromState } from '../../av-moderation/functions';
6
+import { isEnabledFromState, isSupported } from '../../av-moderation/functions';
7 7
 import { Dialog } from '../../base/dialog';
8 8
 import { MEDIA_TYPE } from '../../base/media';
9 9
 import { getLocalParticipant, getParticipantDisplayName } from '../../base/participants';
@@ -23,7 +23,8 @@ export type Props = AbstractProps & {
23 23
     exclude: Array<string>,
24 24
     title: string,
25 25
     showAdvancedModerationToggle: boolean,
26
-    isAudioModerationEnabled: boolean
26
+    isAudioModerationEnabled: boolean,
27
+    isModerationSupported: boolean
27 28
 };
28 29
 
29 30
 type State = {
@@ -135,6 +136,7 @@ export function abstractMapStateToProps(state: Object, ownProps: Props) {
135 136
         title: t('dialog.muteEveryoneElseTitle', { whom })
136 137
     } : {
137 138
         title: t('dialog.muteEveryoneTitle'),
138
-        isAudioModerationEnabled: isEnabledFromState(MEDIA_TYPE.AUDIO, state)
139
+        isAudioModerationEnabled: isEnabledFromState(MEDIA_TYPE.AUDIO, state),
140
+        isModerationSupported: isSupported()(state)
139 141
     };
140 142
 }

+ 5
- 3
react/features/video-menu/components/AbstractMuteEveryonesVideoDialog.js 查看文件

@@ -3,7 +3,7 @@
3 3
 import React from 'react';
4 4
 
5 5
 import { requestDisableVideoModeration, requestEnableVideoModeration } from '../../av-moderation/actions';
6
-import { isEnabledFromState } from '../../av-moderation/functions';
6
+import { isEnabledFromState, isSupported } from '../../av-moderation/functions';
7 7
 import { Dialog } from '../../base/dialog';
8 8
 import { MEDIA_TYPE } from '../../base/media';
9 9
 import { getLocalParticipant, getParticipantDisplayName } from '../../base/participants';
@@ -23,7 +23,8 @@ export type Props = AbstractProps & {
23 23
     exclude: Array<string>,
24 24
     title: string,
25 25
     showAdvancedModerationToggle: boolean,
26
-    isVideoModerationEnabled: boolean
26
+    isVideoModerationEnabled: boolean,
27
+    isModerationSupported: boolean
27 28
 };
28 29
 
29 30
 type State = {
@@ -137,6 +138,7 @@ export function abstractMapStateToProps(state: Object, ownProps: Props) {
137 138
         title: t('dialog.muteEveryoneElsesVideoTitle', { whom })
138 139
     } : {
139 140
         title: t('dialog.muteEveryonesVideoTitle'),
140
-        isVideoModerationEnabled
141
+        isVideoModerationEnabled,
142
+        isModerationSupported: isSupported()(state)
141 143
     };
142 144
 }

+ 1
- 1
react/features/video-menu/components/web/MuteEveryoneDialog.js 查看文件

@@ -48,7 +48,7 @@ class MuteEveryoneDialog extends AbstractMuteEveryoneDialog<Props> {
48 48
                 width = 'small'>
49 49
                 <div className = 'mute-dialog'>
50 50
                     { this.state.content }
51
-                    {this.props.exclude.length === 0 && (
51
+                    { this.props.isModerationSupported && this.props.exclude.length === 0 && (
52 52
                         <>
53 53
                             <div className = 'separator-line' />
54 54
                             <div className = 'control-row'>

+ 1
- 1
react/features/video-menu/components/web/MuteEveryonesVideoDialog.js 查看文件

@@ -48,7 +48,7 @@ class MuteEveryonesVideoDialog extends AbstractMuteEveryonesVideoDialog<Props> {
48 48
                 width = 'small'>
49 49
                 <div className = 'mute-dialog'>
50 50
                     {this.state.content}
51
-                    {this.props.exclude.length === 0 && (
51
+                    { this.props.isModerationSupported && this.props.exclude.length === 0 && (
52 52
                         <>
53 53
                             <div className = 'separator-line' />
54 54
                             <div className = 'control-row'>

Loading…
取消
儲存