Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lang/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@
},
"actions": {
"allow": "Allow attendees to:",
"allowVideo": "Allow video",
"audioModeration": "Unmute themselves",
"blockEveryoneMicCamera": "Block everyone's mic and camera",
"invite": "Invite Someone",
Expand Down
10 changes: 8 additions & 2 deletions react/features/av-moderation/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import { getConferenceState } from '../base/conference';
import { MEDIA_TYPE, type MediaType } from '../base/media/constants';
import { getParticipantById } from '../base/participants';
import { isForceMuted } from '../participants-pane/functions';

import {
DISMISS_PENDING_PARTICIPANT,
Expand All @@ -27,11 +29,15 @@ import { isEnabledFromState } from './functions';
export const approveParticipant = (id: string) => (dispatch: Function, getState: Function) => {
const state = getState();
const { conference } = getConferenceState(state);
const participant = getParticipantById(state, id);

if (isEnabledFromState(MEDIA_TYPE.AUDIO, state)) {
const isAudioForceMuted = isForceMuted(participant, MEDIA_TYPE.AUDIO, state);
const isVideoForceMuted = isForceMuted(participant, MEDIA_TYPE.VIDEO, state);

if (isEnabledFromState(MEDIA_TYPE.AUDIO, state) && isAudioForceMuted) {
conference.avModerationApprove(MEDIA_TYPE.AUDIO, id);
}
if (isEnabledFromState(MEDIA_TYPE.VIDEO, state)) {
if (isEnabledFromState(MEDIA_TYPE.VIDEO, state) && isVideoForceMuted) {
conference.avModerationApprove(MEDIA_TYPE.VIDEO, id);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import React, { useCallback, useEffect, useState } from 'react';

import { translate } from '../../../base/i18n';
import { JitsiTrackEvents } from '../../../base/lib-jitsi-meet';
import { MEDIA_TYPE } from '../../../base/media';
import {
Expand Down Expand Up @@ -135,6 +136,11 @@ type Props = {
*/
participantID: ?string,

/**
* The translate function.
*/
t: Function,

/**
* The translated "you" text.
*/
Expand Down Expand Up @@ -167,6 +173,7 @@ function MeetingParticipantItem({
openDrawerForParticipant,
overflowDrawer,
participantActionEllipsisLabel,
t,
youText
}: Props) {

Expand Down Expand Up @@ -202,6 +209,12 @@ function MeetingParticipantItem({
const audioMediaState = _audioMediaState === MEDIA_STATE.UNMUTED && hasAudioLevels
? MEDIA_STATE.DOMINANT_SPEAKER : _audioMediaState;

let askToUnmuteText = askUnmuteText;

if (_audioMediaState !== MEDIA_STATE.FORCE_MUTED && _videoMediaState === MEDIA_STATE.FORCE_MUTED) {
askToUnmuteText = t('participantsPane.actions.allowVideo');
}

return (
<ParticipantItem
actionsTrigger = { ACTION_TRIGGER.HOVER }
Expand All @@ -221,7 +234,7 @@ function MeetingParticipantItem({
{!overflowDrawer && !_participant?.isFakeParticipant
&& <>
<ParticipantQuickAction
askUnmuteText = { askUnmuteText }
askUnmuteText = { askToUnmuteText }
buttonType = { _quickActionButtonType }
muteAudio = { muteAudio }
muteParticipantButtonText = { muteParticipantButtonText }
Expand Down Expand Up @@ -280,4 +293,4 @@ function _mapStateToProps(state, ownProps): Object {
};
}

export default connect(_mapStateToProps)(MeetingParticipantItem);
export default translate(connect(_mapStateToProps)(MeetingParticipantItem));