Browse Source

fix(av-moderation) Display Allow Video instead of Ask to Unmute (#9991)

When the user is allowed audio but not video display Allow Video button instead of Ask to Unmute
master
robertpin 3 years ago
parent
commit
703e43ecd7
No account linked to committer's email address

+ 1
- 0
lang/main.json View File

@@ -615,6 +615,7 @@
615 615
         },
616 616
         "actions": {
617 617
             "allow": "Allow attendees to:",
618
+            "allowVideo": "Allow video",
618 619
             "audioModeration": "Unmute themselves",
619 620
             "blockEveryoneMicCamera": "Block everyone's mic and camera",
620 621
             "invite": "Invite Someone",

+ 8
- 2
react/features/av-moderation/actions.js View File

@@ -2,6 +2,8 @@
2 2
 
3 3
 import { getConferenceState } from '../base/conference';
4 4
 import { MEDIA_TYPE, type MediaType } from '../base/media/constants';
5
+import { getParticipantById } from '../base/participants';
6
+import { isForceMuted } from '../participants-pane/functions';
5 7
 
6 8
 import {
7 9
     DISMISS_PENDING_PARTICIPANT,
@@ -27,11 +29,15 @@ import { isEnabledFromState } from './functions';
27 29
 export const approveParticipant = (id: string) => (dispatch: Function, getState: Function) => {
28 30
     const state = getState();
29 31
     const { conference } = getConferenceState(state);
32
+    const participant = getParticipantById(state, id);
30 33
 
31
-    if (isEnabledFromState(MEDIA_TYPE.AUDIO, state)) {
34
+    const isAudioForceMuted = isForceMuted(participant, MEDIA_TYPE.AUDIO, state);
35
+    const isVideoForceMuted = isForceMuted(participant, MEDIA_TYPE.VIDEO, state);
36
+
37
+    if (isEnabledFromState(MEDIA_TYPE.AUDIO, state) && isAudioForceMuted) {
32 38
         conference.avModerationApprove(MEDIA_TYPE.AUDIO, id);
33 39
     }
34
-    if (isEnabledFromState(MEDIA_TYPE.VIDEO, state)) {
40
+    if (isEnabledFromState(MEDIA_TYPE.VIDEO, state) && isVideoForceMuted) {
35 41
         conference.avModerationApprove(MEDIA_TYPE.VIDEO, id);
36 42
     }
37 43
 };

+ 15
- 2
react/features/participants-pane/components/web/MeetingParticipantItem.js View File

@@ -2,6 +2,7 @@
2 2
 
3 3
 import React, { useCallback, useEffect, useState } from 'react';
4 4
 
5
+import { translate } from '../../../base/i18n';
5 6
 import { JitsiTrackEvents } from '../../../base/lib-jitsi-meet';
6 7
 import { MEDIA_TYPE } from '../../../base/media';
7 8
 import {
@@ -135,6 +136,11 @@ type Props = {
135 136
      */
136 137
     participantID: ?string,
137 138
 
139
+    /**
140
+     * The translate function.
141
+     */
142
+    t: Function,
143
+
138 144
     /**
139 145
      * The translated "you" text.
140 146
      */
@@ -167,6 +173,7 @@ function MeetingParticipantItem({
167 173
     openDrawerForParticipant,
168 174
     overflowDrawer,
169 175
     participantActionEllipsisLabel,
176
+    t,
170 177
     youText
171 178
 }: Props) {
172 179
 
@@ -202,6 +209,12 @@ function MeetingParticipantItem({
202 209
     const audioMediaState = _audioMediaState === MEDIA_STATE.UNMUTED && hasAudioLevels
203 210
         ? MEDIA_STATE.DOMINANT_SPEAKER : _audioMediaState;
204 211
 
212
+    let askToUnmuteText = askUnmuteText;
213
+
214
+    if (_audioMediaState !== MEDIA_STATE.FORCE_MUTED && _videoMediaState === MEDIA_STATE.FORCE_MUTED) {
215
+        askToUnmuteText = t('participantsPane.actions.allowVideo');
216
+    }
217
+
205 218
     return (
206 219
         <ParticipantItem
207 220
             actionsTrigger = { ACTION_TRIGGER.HOVER }
@@ -221,7 +234,7 @@ function MeetingParticipantItem({
221 234
             {!overflowDrawer && !_participant?.isFakeParticipant
222 235
                 && <>
223 236
                     <ParticipantQuickAction
224
-                        askUnmuteText = { askUnmuteText }
237
+                        askUnmuteText = { askToUnmuteText }
225 238
                         buttonType = { _quickActionButtonType }
226 239
                         muteAudio = { muteAudio }
227 240
                         muteParticipantButtonText = { muteParticipantButtonText }
@@ -280,4 +293,4 @@ function _mapStateToProps(state, ownProps): Object {
280 293
     };
281 294
 }
282 295
 
283
-export default connect(_mapStateToProps)(MeetingParticipantItem);
296
+export default translate(connect(_mapStateToProps)(MeetingParticipantItem));

Loading…
Cancel
Save