fix: immediately clean up voice state when voice-active socket disconnects
Previously, voice cleanup only happened in finalizeDisconnect after a 5-second grace period, and only when ALL connections closed. If a user was logged in on multiple devices and closed the one in voice, the voice state was never cleaned up — creating a permanent ghost in the channel sidebar. Now removeConnection checks if the closing socket is the voice-active one (tracked via voiceWs map) and immediately cleans up voice state, broadcasts the leave event, and notifies remaining tabs.
This commit is contained in:
@@ -395,7 +395,7 @@ export type ServerEvent =
|
||||
| { type: 'voice_space_deafened'; userId: string; channelId: string; spaceId: string; deafened: boolean }
|
||||
| { type: 'voice_permission_muted'; userId: string; spaceId: string; muted: boolean }
|
||||
| { type: 'voice_moved'; userId: string; oldChannelId: string; newChannelId: string }
|
||||
| { type: 'voice_disconnected'; userId: string; channelId: string; reason?: 'displaced' }
|
||||
| { type: 'voice_disconnected'; userId: string; channelId: string; reason?: 'displaced' | 'session_closed' }
|
||||
| { type: 'user_updated'; user: User }
|
||||
| { type: 'member_banned'; spaceId: string; reason: string | null }
|
||||
| { type: 'category_created'; category: ChannelCategory; spaceId: string }
|
||||
|
||||
Reference in New Issue
Block a user