fix(av-moderation) Update function that calculates quick action button
This commit is contained in:
parent
001ae54a7c
commit
8fd7b10f06
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import React, { useCallback, useEffect, useState } from 'react';
|
import React, { useCallback, useEffect, useState } from 'react';
|
||||||
|
|
||||||
import { isSupported } from '../../../av-moderation/functions';
|
|
||||||
import { translate } from '../../../base/i18n';
|
import { translate } from '../../../base/i18n';
|
||||||
import { JitsiTrackEvents } from '../../../base/lib-jitsi-meet';
|
import { JitsiTrackEvents } from '../../../base/lib-jitsi-meet';
|
||||||
import { MEDIA_TYPE } from '../../../base/media';
|
import { MEDIA_TYPE } from '../../../base/media';
|
||||||
|
@ -10,7 +9,6 @@ import {
|
||||||
getLocalParticipant,
|
getLocalParticipant,
|
||||||
getParticipantByIdOrUndefined,
|
getParticipantByIdOrUndefined,
|
||||||
getParticipantDisplayName,
|
getParticipantDisplayName,
|
||||||
isLocalParticipantModerator,
|
|
||||||
isParticipantModerator
|
isParticipantModerator
|
||||||
} from '../../../base/participants';
|
} from '../../../base/participants';
|
||||||
import { connect } from '../../../base/redux';
|
import { connect } from '../../../base/redux';
|
||||||
|
@ -20,7 +18,7 @@ import {
|
||||||
isParticipantAudioMuted,
|
isParticipantAudioMuted,
|
||||||
isParticipantVideoMuted
|
isParticipantVideoMuted
|
||||||
} from '../../../base/tracks';
|
} from '../../../base/tracks';
|
||||||
import { ACTION_TRIGGER, type MediaState, MEDIA_STATE, QUICK_ACTION_BUTTON } from '../../constants';
|
import { ACTION_TRIGGER, type MediaState, MEDIA_STATE } from '../../constants';
|
||||||
import {
|
import {
|
||||||
getParticipantAudioMediaState,
|
getParticipantAudioMediaState,
|
||||||
getParticipantVideoMediaState,
|
getParticipantVideoMediaState,
|
||||||
|
@ -174,9 +172,7 @@ function MeetingParticipantItem({
|
||||||
_audioTrack,
|
_audioTrack,
|
||||||
_disableModeratorIndicator,
|
_disableModeratorIndicator,
|
||||||
_displayName,
|
_displayName,
|
||||||
_isModerationSupported,
|
|
||||||
_local,
|
_local,
|
||||||
_localModerator,
|
|
||||||
_localVideoOwner,
|
_localVideoOwner,
|
||||||
_participant,
|
_participant,
|
||||||
_participantID,
|
_participantID,
|
||||||
|
@ -234,12 +230,6 @@ function MeetingParticipantItem({
|
||||||
askToUnmuteText = t('participantsPane.actions.allowVideo');
|
askToUnmuteText = t('participantsPane.actions.allowVideo');
|
||||||
}
|
}
|
||||||
|
|
||||||
const buttonType = _isModerationSupported
|
|
||||||
? _localModerator && _audioMediaState !== MEDIA_STATE.UNMUTED
|
|
||||||
? QUICK_ACTION_BUTTON.ASK_TO_UNMUTE
|
|
||||||
: _quickActionButtonType
|
|
||||||
: '';
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ParticipantItem
|
<ParticipantItem
|
||||||
actionsTrigger = { ACTION_TRIGGER.HOVER }
|
actionsTrigger = { ACTION_TRIGGER.HOVER }
|
||||||
|
@ -261,7 +251,7 @@ function MeetingParticipantItem({
|
||||||
&& <>
|
&& <>
|
||||||
<ParticipantQuickAction
|
<ParticipantQuickAction
|
||||||
askUnmuteText = { askToUnmuteText }
|
askUnmuteText = { askToUnmuteText }
|
||||||
buttonType = { buttonType }
|
buttonType = { _quickActionButtonType }
|
||||||
muteAudio = { muteAudio }
|
muteAudio = { muteAudio }
|
||||||
muteParticipantButtonText = { muteParticipantButtonText }
|
muteParticipantButtonText = { muteParticipantButtonText }
|
||||||
participantID = { _participantID } />
|
participantID = { _participantID } />
|
||||||
|
@ -307,16 +297,12 @@ function _mapStateToProps(state, ownProps): Object {
|
||||||
|
|
||||||
const { disableModeratorIndicator } = state['features/base/config'];
|
const { disableModeratorIndicator } = state['features/base/config'];
|
||||||
|
|
||||||
const _localModerator = isLocalParticipantModerator(state);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
_audioMediaState,
|
_audioMediaState,
|
||||||
_audioTrack,
|
_audioTrack,
|
||||||
_disableModeratorIndicator: disableModeratorIndicator,
|
_disableModeratorIndicator: disableModeratorIndicator,
|
||||||
_displayName: getParticipantDisplayName(state, participant?.id),
|
_displayName: getParticipantDisplayName(state, participant?.id),
|
||||||
_isModerationSupported: isSupported()(state),
|
|
||||||
_local: Boolean(participant?.local),
|
_local: Boolean(participant?.local),
|
||||||
_localModerator,
|
|
||||||
_localVideoOwner: Boolean(ownerId === localParticipantId),
|
_localVideoOwner: Boolean(ownerId === localParticipantId),
|
||||||
_participant: participant,
|
_participant: participant,
|
||||||
_participantID: participant?.id,
|
_participantID: participant?.id,
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
import {
|
import {
|
||||||
isParticipantApproved,
|
isParticipantApproved,
|
||||||
isEnabledFromState,
|
isEnabledFromState,
|
||||||
isLocalParticipantApprovedFromState
|
isLocalParticipantApprovedFromState,
|
||||||
|
isSupported
|
||||||
} from '../av-moderation/functions';
|
} from '../av-moderation/functions';
|
||||||
import { getFeatureFlag, INVITE_ENABLED } from '../base/flags';
|
import { getFeatureFlag, INVITE_ENABLED } from '../base/flags';
|
||||||
import { MEDIA_TYPE, type MediaType } from '../base/media/constants';
|
import { MEDIA_TYPE, type MediaType } from '../base/media/constants';
|
||||||
|
@ -164,12 +165,12 @@ export const getParticipantsPaneOpen = (state: Object) => Boolean(getState(state
|
||||||
export function getQuickActionButtonType(participant: Object, isAudioMuted: Boolean, state: Object) {
|
export function getQuickActionButtonType(participant: Object, isAudioMuted: Boolean, state: Object) {
|
||||||
// handled only by moderators
|
// handled only by moderators
|
||||||
if (isLocalParticipantModerator(state)) {
|
if (isLocalParticipantModerator(state)) {
|
||||||
if (isForceMuted(participant, MEDIA_TYPE.AUDIO, state) || isForceMuted(participant, MEDIA_TYPE.VIDEO, state)) {
|
|
||||||
return QUICK_ACTION_BUTTON.ASK_TO_UNMUTE;
|
|
||||||
}
|
|
||||||
if (!isAudioMuted) {
|
if (!isAudioMuted) {
|
||||||
return QUICK_ACTION_BUTTON.MUTE;
|
return QUICK_ACTION_BUTTON.MUTE;
|
||||||
}
|
}
|
||||||
|
if (isSupported()(state)) {
|
||||||
|
return QUICK_ACTION_BUTTON.ASK_TO_UNMUTE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QUICK_ACTION_BUTTON.NONE;
|
return QUICK_ACTION_BUTTON.NONE;
|
||||||
|
|
Loading…
Reference in New Issue