fix: guard voice controls against toggling intent while server muted/deafened

This commit is contained in:
Jannis Braun
2026-03-09 23:15:47 +01:00
parent 018828575c
commit 651d7edf9d
3 changed files with 25 additions and 4 deletions
@@ -43,6 +43,7 @@ export function ChannelSidebar() {
const location = useLocation();
const handleMicToggle = async () => {
if (isServerMuted || isServerDeafened) return;
const wasDeafened = useVoiceStore.getState().isDeafened;
toggleMic();
broadcastVoiceStatus();
@@ -53,6 +54,7 @@ export function ChannelSidebar() {
};
const handleDeafenToggle = async () => {
if (isServerDeafened) return;
toggleDeafen();
broadcastVoiceStatus();
broadcastDeafenViaLiveKit();
@@ -39,6 +39,7 @@ export function VoiceControlBar() {
const qualityBtnRef = useRef<HTMLButtonElement>(null);
const handleMute = React.useCallback(async () => {
if (isServerMuted || isServerDeafened) return;
const wasDeafened = useVoiceStore.getState().isDeafened;
toggleMic();
broadcastVoiceStatus();
@@ -46,13 +47,14 @@ export function VoiceControlBar() {
if (wasDeafened && !useVoiceStore.getState().isDeafened) {
broadcastDeafenViaLiveKit();
}
}, [toggleMic]);
}, [isServerMuted, isServerDeafened, toggleMic]);
const handleDeafen = React.useCallback(async () => {
if (isServerDeafened) return;
toggleDeafen();
broadcastVoiceStatus();
broadcastDeafenViaLiveKit();
}, [toggleDeafen]);
}, [isServerDeafened, toggleDeafen]);
const handleCamera = async () => {
const room = getActiveRoom();