fix: should now sync with other devices
All checks were successful
Queue Release Build / prepare (push) Successful in 25s
Deploy Web Apps / deploy (push) Successful in 7m8s
Queue Release Build / build-windows (push) Successful in 28m10s
Queue Release Build / build-linux (push) Successful in 44m38s
Queue Release Build / build-android (push) Successful in 18m36s
Queue Release Build / finalize (push) Successful in 1m40s

This commit is contained in:
2026-06-09 22:00:39 +02:00
parent 1274ad9b46
commit d0aff6319d
16 changed files with 619 additions and 5 deletions

View File

@@ -24,6 +24,7 @@ import {
} from '../../shared-kernel';
import type { ChatEvent, User } from '../../shared-kernel';
import { RealtimeSessionFacade } from '../../core/realtime';
import { pushProfileViaAccountSync as relayProfileViaAccountSync } from '../../infrastructure/realtime/account-sync/account-sync-profile.helper';
import { DatabaseService } from '../../infrastructure/persistence';
import { UsersActions } from './users.actions';
import { selectAllUsers, selectCurrentUser } from './users.selectors';
@@ -33,6 +34,8 @@ import { findRoomMember } from '../rooms/room-members.helpers';
interface PendingAvatarTransfer {
displayName: string;
description?: string;
profileUpdatedAt?: number;
mime?: string;
oderId: string;
total: number;
@@ -206,6 +209,7 @@ export class UserAvatarEffects {
}
this.webrtc.broadcastMessage(this.buildAvatarSummary(currentUser));
void relayProfileViaAccountSync(this.webrtc, currentUser);
})
),
{ dispatch: false }
@@ -236,7 +240,7 @@ export class UserAvatarEffects {
]) => {
switch (event.type) {
case 'user-avatar-summary':
return this.handleAvatarSummary(event, allUsers);
return this.handleAvatarSummary(event, allUsers, currentUser ?? null);
case 'user-avatar-request':
return this.handleAvatarRequest(event, currentUser ?? null);
@@ -263,11 +267,17 @@ export class UserAvatarEffects {
};
}
private handleAvatarSummary(event: ChatEvent, allUsers: User[]) {
private handleAvatarSummary(event: ChatEvent, allUsers: User[], currentUser: User | null) {
if (!event.fromPeerId || !event.oderId || !event.avatarUpdatedAt) {
return EMPTY;
}
const currentUserKey = currentUser?.oderId || currentUser?.id;
if (currentUserKey && event.oderId === currentUserKey) {
return EMPTY;
}
const existingUser = allUsers.find((user) => user.id === event.oderId || user.oderId === event.oderId);
if (!shouldRequestAvatarData(existingUser, event)) {
@@ -301,6 +311,8 @@ export class UserAvatarEffects {
return from(this.buildRemoteAvatarAction({
chunks: [],
displayName: event.displayName || 'User',
description: event.description,
profileUpdatedAt: event.profileUpdatedAt,
mime: event.avatarMime,
oderId: event.oderId,
total: 0,
@@ -319,6 +331,8 @@ export class UserAvatarEffects {
this.pendingTransfers.set(event.oderId, {
chunks: new Array<string | undefined>(event.total),
displayName: event.displayName || 'User',
description: event.description,
profileUpdatedAt: event.profileUpdatedAt,
mime: event.avatarMime,
oderId: event.oderId,
total: event.total,
@@ -387,6 +401,8 @@ export class UserAvatarEffects {
oderId: existingUser?.oderId || transfer.oderId,
username: existingUser?.username || transfer.username,
displayName: transfer.displayName || existingUser?.displayName || 'User',
description: transfer.description ?? existingUser?.description,
profileUpdatedAt: transfer.profileUpdatedAt ?? existingUser?.profileUpdatedAt,
avatarUrl: dataUrl,
avatarHash: transfer.hash,
avatarMime: transfer.mime,