fix(voice): broadcast VOICE_JOIN/LEAVE via ws, show participants in sidebar for all users
This commit is contained in:
@@ -5,6 +5,7 @@ import { useServerStore } from './server.ts';
|
||||
import { usePresenceStore } from './presence.ts';
|
||||
import { useTypingStore } from './typing.ts';
|
||||
import { useVoiceStore } from './voice.ts';
|
||||
import { useVoicePresenceStore } from './voicePresence.ts';
|
||||
import { useAuthStore } from './auth.ts';
|
||||
import { useConversationStore } from './conversation.ts';
|
||||
import { useReadStatesStore } from './readStates.ts';
|
||||
@@ -274,6 +275,24 @@ export const useWebSocketStore = create<WebSocketState>((set, get) => ({
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'VOICE_JOIN': {
|
||||
const { room_name, user_id, username } = payload as Record<string, string>;
|
||||
if (room_name && user_id && username) {
|
||||
useVoicePresenceStore.getState()._handleJoin({
|
||||
userId: user_id,
|
||||
username,
|
||||
channelId: room_name,
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'VOICE_LEAVE': {
|
||||
const { room_name, user_id } = payload as Record<string, string>;
|
||||
if (room_name && user_id) {
|
||||
useVoicePresenceStore.getState()._handleLeave(user_id, room_name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user