fix: multiple bug fixes

isolated users, db backup, weird disconnect issues for long voice sessions,
This commit is contained in:
2026-04-24 22:19:57 +02:00
parent 44588e8789
commit bc2fa7de22
56 changed files with 1861 additions and 133 deletions

View File

@@ -235,6 +235,71 @@ describe('users reducer - status', () => {
// The buildPresenceAwareUser function takes incoming status when non-offline
expect(state.entities['u1']?.status).toBe('online');
});
it('preserves omitted live peer presence and voice state during stale server snapshot', () => {
const remoteUser = createUser({
id: 'u2',
oderId: 'u2',
displayName: 'Voice Peer',
presenceServerIds: ['s1'],
voiceState: {
isConnected: true,
isMuted: false,
isDeafened: false,
isSpeaking: true,
roomId: 'voice-1',
serverId: 's1'
},
cameraState: { isEnabled: true },
screenShareState: { isSharing: true }
});
const withUser = usersReducer(baseState, UsersActions.userJoined({ user: remoteUser }));
const state = usersReducer(withUser, UsersActions.syncServerPresence({
roomId: 's1',
users: [],
connectedPeerIds: ['u2']
}));
expect(state.entities['u2']?.presenceServerIds).toEqual(['s1']);
expect(state.entities['u2']?.isOnline).toBe(true);
expect(state.entities['u2']?.voiceState?.isConnected).toBe(true);
expect(state.entities['u2']?.voiceState?.roomId).toBe('voice-1');
expect(state.entities['u2']?.cameraState?.isEnabled).toBe(true);
expect(state.entities['u2']?.screenShareState?.isSharing).toBe(true);
});
it('clears omitted peer live state when transport is gone', () => {
const remoteUser = createUser({
id: 'u3',
oderId: 'u3',
displayName: 'Dropped Peer',
presenceServerIds: ['s1'],
voiceState: {
isConnected: true,
isMuted: false,
isDeafened: false,
isSpeaking: true,
roomId: 'voice-1',
serverId: 's1'
},
cameraState: { isEnabled: true },
screenShareState: { isSharing: true }
});
const withUser = usersReducer(baseState, UsersActions.userJoined({ user: remoteUser }));
const state = usersReducer(withUser, UsersActions.syncServerPresence({
roomId: 's1',
users: [],
connectedPeerIds: []
}));
expect(state.entities['u3']?.presenceServerIds).toBeUndefined();
expect(state.entities['u3']?.isOnline).toBe(false);
expect(state.entities['u3']?.status).toBe('offline');
expect(state.entities['u3']?.voiceState?.isConnected).toBe(false);
expect(state.entities['u3']?.voiceState?.roomId).toBeUndefined();
expect(state.entities['u3']?.cameraState?.isEnabled).toBe(false);
expect(state.entities['u3']?.screenShareState?.isSharing).toBe(false);
});
});
describe('manual status overrides auto idle', () => {