mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-02 17:32:50 +08:00
Fix talking indicator: also respect missing talk power in moderated channels
The previous fix only accounted for the local mute toggle. In a moderated channel (one with a talk power requirement) a client without sufficient talk power still has selfActive/VAD firing locally and no local concept of whether they're actually allowed to transmit, so the indicator stayed on regardless. The connector now computes has_talk_power per client from the book state (talk_power_granted || talk_power >= channel.needed_talk_power), mirroring tsclientlib's own internal intern_can_send_audio moderated-channel check, and threads it through gateway and frontend. The talking indicator (both the own-client injection into displayTalkers and the general per-client render in ChannelTree) now requires hasTalkPower too.
This commit is contained in:
1 parent
4847972c80
commit
6e343c4d4c
4 files changed
+46
-21
No files matched your search
+5
-2
@@ -330,6 +330,7 @@ interface ClientInfo {
|
||||
databaseId: number;
|
||||
channelGroup: number;
|
||||
serverGroups: number[];
|
||||
hasTalkPower: boolean;
|
||||
}
|
||||
|
||||
interface GroupEntry {
|
||||
@@ -533,7 +534,7 @@ function ChannelTree({
|
||||
<li key={c.id}>
|
||||
<div
|
||||
className={`ts-row ts-client-row${c.id === ownClientId ? " ts-self" : ""}${
|
||||
talkers.has(c.id) ? " ts-talking" : ""
|
||||
talkers.has(c.id) && c.hasTalkPower ? " ts-talking" : ""
|
||||
}`}
|
||||
onClick={c.id === ownClientId ? undefined : () => onOpenPrivateChat(c.id, c.name)}
|
||||
onContextMenu={(e) => onClientContextMenu(e, c.id, c.name, c.id === ownClientId)}
|
||||
@@ -5839,7 +5840,9 @@ function AppInner() {
|
||||
const inputMuted = ownClient?.inputMuted ?? false;
|
||||
const outputMuted = ownClient?.outputMuted ?? false;
|
||||
const displayTalkers =
|
||||
selfActive && !inputMuted && ownClient ? new Set(talkers).add(ownClient.id) : talkers;
|
||||
selfActive && !inputMuted && ownClient?.hasTalkPower
|
||||
? new Set(talkers).add(ownClient.id)
|
||||
: talkers;
|
||||
const t = useT();
|
||||
|
||||
return (
|
||||
|
||||
+6
-4
@@ -33,6 +33,7 @@ interface DemoClient {
|
||||
databaseId: number;
|
||||
channelGroup: number;
|
||||
serverGroups: number[];
|
||||
hasTalkPower: boolean;
|
||||
}
|
||||
|
||||
const DEMO_CHANNELS: DemoChannel[] = [
|
||||
@@ -56,10 +57,10 @@ const DEMO_SERVER_GROUPS = [
|
||||
];
|
||||
|
||||
const DEMO_NPCS: DemoClient[] = [
|
||||
{ id: 102, channel: 1, name: "Alex", inputMuted: false, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: true, country: "US", uid: "demo-uid-alex", databaseId: 2, channelGroup: 2, serverGroups: [2] },
|
||||
{ id: 103, channel: 2, name: "Sam", inputMuted: false, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: false, country: "GB", uid: "demo-uid-sam", databaseId: 3, channelGroup: 4, serverGroups: [4] },
|
||||
{ id: 104, channel: 2, name: "Jordan", inputMuted: true, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: false, country: "CA", uid: "demo-uid-jordan", databaseId: 4, channelGroup: 4, serverGroups: [4] },
|
||||
{ id: 105, channel: 3, name: "Riley", inputMuted: false, outputMuted: false, inputHardwareEnabled: true, away: true, awayMessage: "brb, grabbing coffee", isChannelCommander: false, country: "DE", uid: "demo-uid-riley", databaseId: 5, channelGroup: 4, serverGroups: [3, 4] },
|
||||
{ id: 102, channel: 1, name: "Alex", inputMuted: false, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: true, country: "US", uid: "demo-uid-alex", databaseId: 2, channelGroup: 2, serverGroups: [2], hasTalkPower: true },
|
||||
{ id: 103, channel: 2, name: "Sam", inputMuted: false, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: false, country: "GB", uid: "demo-uid-sam", databaseId: 3, channelGroup: 4, serverGroups: [4], hasTalkPower: true },
|
||||
{ id: 104, channel: 2, name: "Jordan", inputMuted: true, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: false, country: "CA", uid: "demo-uid-jordan", databaseId: 4, channelGroup: 4, serverGroups: [4], hasTalkPower: true },
|
||||
{ id: 105, channel: 3, name: "Riley", inputMuted: false, outputMuted: false, inputHardwareEnabled: true, away: true, awayMessage: "brb, grabbing coffee", isChannelCommander: false, country: "DE", uid: "demo-uid-riley", databaseId: 5, channelGroup: 4, serverGroups: [3, 4], hasTalkPower: true },
|
||||
];
|
||||
|
||||
interface DemoFileEntry {
|
||||
@@ -617,6 +618,7 @@ export class DemoSocket {
|
||||
databaseId: 1,
|
||||
channelGroup: this.selfChannelGroup,
|
||||
serverGroups: [...this.selfServerGroups],
|
||||
hasTalkPower: true,
|
||||
};
|
||||
this.emit({ type: "channels", channels: DEMO_CHANNELS, clients: [self, ...DEMO_NPCS] });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user