fix: server-deafen now shows amber mute icon across all UI surfaces

When a moderator server-deafens a user, the implied mute is server-imposed
and should display amber (not red) everywhere. Updated VoiceControlBar,
ChannelSidebar, VoiceChannel, and VoiceUser to check isServerDeafened
alongside isServerMuted for amber color and cursor-not-allowed state.

Also includes smart mute/deafen toggle logic (Discord-style coupling),
server-side enforcement of mute/deafen bypass, and cleanup of server
voice state on user departure.
This commit is contained in:
Jannis Braun
2026-03-09 17:12:00 +01:00
parent e2c18ad2b0
commit f6cdfe993f
7 changed files with 129 additions and 76 deletions
+8 -3
View File
@@ -484,6 +484,7 @@ function handleVoiceLeave(userId: string): void {
broadcastRoomLeave(left.roomId, left.room, userId);
}
connectionManager.clearVoiceUserStatus(userId);
connectionManager.clearServerVoiceState(userId);
}
function handleVoiceStatus(event: Record<string, unknown>, userId: string): void {
@@ -497,15 +498,19 @@ function handleVoiceStatus(event: Record<string, unknown>, userId: string): void
const userRoom = connectionManager.getUserRoom(userId);
if (!userRoom) return;
connectionManager.setVoiceUserStatus(userId, isMuted, isDeafened, isCameraOn, isScreenSharing);
// Server-side enforcement: prevent clients from bypassing server mute/deafen
const effectiveMuted = connectionManager.isServerMuted(userId) ? true : isMuted;
const effectiveDeafened = connectionManager.isServerDeafened(userId) ? true : isDeafened;
connectionManager.setVoiceUserStatus(userId, effectiveMuted, effectiveDeafened, isCameraOn, isScreenSharing);
// sendToRoom routes to sendToSpace for space rooms, sendToDmMembers for DM rooms
connectionManager.sendToRoom(userRoom.roomId, {
type: 'voice_status_update',
userId,
channelId: userRoom.roomId,
isMuted,
isDeafened,
isMuted: effectiveMuted,
isDeafened: effectiveDeafened,
isCameraOn,
isScreenSharing,
});