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:
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user