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:
@@ -20,6 +20,8 @@ export function VoiceUser({ tile, large }: VoiceUserProps) {
|
||||
const currentVoiceChannelId = useVoiceStore((s) => s.currentVoiceChannelId);
|
||||
const participantVolumes = useVoiceStore((s) => s.participantVolumes);
|
||||
const isSpeaking = useVoiceStore((s) => s.speakingParticipantIds.has(participant.identity));
|
||||
const serverMutedUserIds = useVoiceStore((s) => s.serverMutedUserIds);
|
||||
const serverDeafenedUserIds = useVoiceStore((s) => s.serverDeafenedUserIds);
|
||||
|
||||
const [, forceUpdate] = useState(0);
|
||||
|
||||
@@ -146,36 +148,45 @@ export function VoiceUser({ tile, large }: VoiceUserProps) {
|
||||
)}
|
||||
</div>
|
||||
<div className="flex items-center gap-1 flex-shrink-0">
|
||||
{participant.isMuted && (
|
||||
<div className="w-5 h-5 bg-accent-rose/90 rounded-full flex items-center justify-center">
|
||||
<svg width="12" height="12" viewBox="0 0 24 24" fill="white">
|
||||
<path d="M12 2C10.9 2 10 2.9 10 4V12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12V4C14 2.9 13.1 2 12 2Z" />
|
||||
<line
|
||||
x1="3"
|
||||
y1="3"
|
||||
x2="21"
|
||||
y2="21"
|
||||
stroke="white"
|
||||
strokeWidth="2"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
)}
|
||||
{(isLocal ? isDeafened : participant.isDeafened) && (
|
||||
<div className="w-5 h-5 bg-accent-rose/90 rounded-full flex items-center justify-center">
|
||||
<svg width="12" height="12" viewBox="0 0 24 24" fill="white">
|
||||
<path d="M12 3c-4.97 0-9 4.03-9 9v7c0 1.1.9 2 2 2h2v-7H5v-2c0-3.87 3.13-7 7-7s7 3.13 7 7v2h-2v7h2c1.1 0 2-.9 2-2v-7c0-4.97-4.03-9-9-9z" />
|
||||
<line
|
||||
x1="3"
|
||||
y1="3"
|
||||
x2="21"
|
||||
y2="21"
|
||||
stroke="white"
|
||||
strokeWidth="2"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
)}
|
||||
{participant.isMuted && (() => {
|
||||
const isServerMutedUser = serverMutedUserIds.has(participant.userId);
|
||||
const isServerDeafenedUser = serverDeafenedUserIds.has(participant.userId);
|
||||
const badgeBg = (isServerMutedUser || isServerDeafenedUser) ? 'bg-accent-amber/90' : 'bg-accent-rose/90';
|
||||
return (
|
||||
<div className={`w-5 h-5 ${badgeBg} rounded-full flex items-center justify-center`}>
|
||||
<svg width="12" height="12" viewBox="0 0 24 24" fill="white">
|
||||
<path d="M12 2C10.9 2 10 2.9 10 4V12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12V4C14 2.9 13.1 2 12 2Z" />
|
||||
<line
|
||||
x1="3"
|
||||
y1="3"
|
||||
x2="21"
|
||||
y2="21"
|
||||
stroke="white"
|
||||
strokeWidth="2"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
);
|
||||
})()}
|
||||
{(isLocal ? isDeafened : participant.isDeafened) && (() => {
|
||||
const isServerDeafenedUser = serverDeafenedUserIds.has(participant.userId);
|
||||
const badgeBg = isServerDeafenedUser ? 'bg-accent-amber/90' : 'bg-accent-rose/90';
|
||||
return (
|
||||
<div className={`w-5 h-5 ${badgeBg} rounded-full flex items-center justify-center`}>
|
||||
<svg width="12" height="12" viewBox="0 0 24 24" fill="white">
|
||||
<path d="M12 3c-4.97 0-9 4.03-9 9v7c0 1.1.9 2 2 2h2v-7H5v-2c0-3.87 3.13-7 7-7s7 3.13 7 7v2h-2v7h2c1.1 0 2-.9 2-2v-7c0-4.97-4.03-9-9-9z" />
|
||||
<line
|
||||
x1="3"
|
||||
y1="3"
|
||||
x2="21"
|
||||
y2="21"
|
||||
stroke="white"
|
||||
strokeWidth="2"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
);
|
||||
})()}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user