feat: Add user metadata changing display name and description with sync
All checks were successful
Queue Release Build / prepare (push) Successful in 28s
Deploy Web Apps / deploy (push) Successful in 5m2s
Queue Release Build / build-windows (push) Successful in 16m44s
Queue Release Build / build-linux (push) Successful in 27m12s
Queue Release Build / finalize (push) Successful in 22s

This commit is contained in:
2026-04-17 22:04:18 +02:00
parent 3ba8a2c9eb
commit bd21568726
41 changed files with 1176 additions and 191 deletions

View File

@@ -140,6 +140,74 @@ describe('users reducer - status', () => {
expect(state.entities['remote-1']?.avatarHash).toBe('hash-newer');
expect(state.entities['remote-1']?.avatarUpdatedAt).toBe(200);
});
it('updates the current user profile metadata', () => {
const state = usersReducer(baseState, UsersActions.updateCurrentUserProfile({
profile: {
displayName: 'Updated User',
description: 'New description',
profileUpdatedAt: 4567
}
}));
expect(state.entities['user-1']?.displayName).toBe('Updated User');
expect(state.entities['user-1']?.description).toBe('New description');
expect(state.entities['user-1']?.profileUpdatedAt).toBe(4567);
});
it('keeps newer remote profile text when stale profile data arrives later', () => {
const withRemote = usersReducer(
baseState,
UsersActions.upsertRemoteUserAvatar({
user: {
id: 'remote-1',
oderId: 'oder-remote-1',
username: 'remote',
displayName: 'Remote Newer',
description: 'Newest bio',
profileUpdatedAt: 300
}
})
);
const state = usersReducer(
withRemote,
UsersActions.upsertRemoteUserAvatar({
user: {
id: 'remote-1',
oderId: 'oder-remote-1',
username: 'remote',
displayName: 'Remote Older',
description: 'Old bio',
profileUpdatedAt: 100
}
})
);
expect(state.entities['remote-1']?.displayName).toBe('Remote Newer');
expect(state.entities['remote-1']?.description).toBe('Newest bio');
expect(state.entities['remote-1']?.profileUpdatedAt).toBe(300);
});
it('allows remote profile-only sync updates without avatar bytes', () => {
const state = usersReducer(
baseState,
UsersActions.upsertRemoteUserAvatar({
user: {
id: 'remote-2',
oderId: 'oder-remote-2',
username: 'remote2',
displayName: 'Remote Profile',
description: 'Profile only sync',
profileUpdatedAt: 700
}
})
);
expect(state.entities['remote-2']?.displayName).toBe('Remote Profile');
expect(state.entities['remote-2']?.description).toBe('Profile only sync');
expect(state.entities['remote-2']?.profileUpdatedAt).toBe(700);
expect(state.entities['remote-2']?.avatarUrl).toBeUndefined();
});
});
describe('presence-aware user with status', () => {