🐛(frontend) fix mic mute for non-admin users in participant list

Resolve regression where non-admin/anonymous users couldn't mute
their microphone from participant list after mute permissions refactoring.
Replace API call with local track mute for better performance and
proper permission handling.
This commit is contained in:
lebaudantoine
2025-09-17 23:17:41 +02:00
committed by aleb_the_flash
parent 4afa03d7c8
commit 04710f5ecd

View File

@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next'
import { Avatar } from '@/components/Avatar'
import { getParticipantColor } from '@/features/rooms/utils/getParticipantColor'
import { getParticipantIsRoomAdmin } from '@/features/rooms/utils/getParticipantIsRoomAdmin'
import { Participant, Track } from 'livekit-client'
import { LocalParticipant, Participant, Track } from 'livekit-client'
import { isLocal } from '@/utils/livekit'
import {
useIsSpeaking,
@@ -54,9 +54,11 @@ const MicIndicator = ({ participant }: MicIndicatorProps) => {
tooltip={label}
aria-label={label}
isDisabled={isMuted || !canMute}
onPress={() =>
onPress={async () =>
!isMuted && isLocal(participant)
? muteParticipant(participant)
? await (participant as LocalParticipant)?.setMicrophoneEnabled(
false
)
: setIsAlertOpen(true)
}
data-attr="participants-mute"