mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-07 19:22:14 +09:00
fix(app): keep voice connections of one session across channels (#3023)
This commit is contained in:
@@ -210,6 +210,28 @@ describe('VoiceGatewayStateMachine', () => {
|
||||
expectProjectionConsistent(snapshot.context);
|
||||
});
|
||||
|
||||
it('keeps same-session connections in different channels', () => {
|
||||
const snapshot = transition(createVoiceGatewayStateSnapshot(), {
|
||||
type: 'guild.create',
|
||||
guild: guild('guild-1', [
|
||||
voiceState({connection_id: 'connection-a', session_id: 'session-a', channel_id: 'channel-1'}),
|
||||
voiceState({connection_id: 'connection-b', session_id: 'session-a', channel_id: 'channel-2'}),
|
||||
]),
|
||||
});
|
||||
|
||||
expectConnection(snapshot.context, 'connection-a', {
|
||||
guild_id: 'guild-1',
|
||||
channel_id: 'channel-1',
|
||||
user_id: 'user-1',
|
||||
});
|
||||
expectConnection(snapshot.context, 'connection-b', {
|
||||
guild_id: 'guild-1',
|
||||
channel_id: 'channel-2',
|
||||
user_id: 'user-1',
|
||||
});
|
||||
expectProjectionConsistent(snapshot.context);
|
||||
});
|
||||
|
||||
it('deletes all user connections in a guild', () => {
|
||||
let snapshot = createVoiceGatewayStateSnapshot();
|
||||
snapshot = transition(snapshot, {
|
||||
|
||||
@@ -200,6 +200,7 @@ function removeStaleSessionConnections(
|
||||
for (const [connectionId, existing] of Object.entries(indexedGuildStates)) {
|
||||
if (connectionId === voiceState.connection_id) continue;
|
||||
if (existing.session_id !== voiceState.session_id) continue;
|
||||
if (existing.channel_id !== voiceState.channel_id) continue;
|
||||
next = removeConnection(next, connectionId);
|
||||
}
|
||||
return next;
|
||||
|
||||
Reference in New Issue
Block a user