fix: live presence on freshly-friended remotes + green dot in same session
Two follow-on bugs from the initial S2S presence rollout:
(1) New friend stuck offline until they reload: presence_update fires only on
transitions, so a remote user already online when their stub is created
locally never receives a relay event seeding their actual status. The
stub defaulted to 'offline' at creation and stayed there until the next
transition. Fix: extend FederationRelayProfileSnapshot +
FederationUserLookupProfile with status. Sender-side buildProfileSnapshot,
getDmParticipants, and lookup endpoint responses populate it for native
users only (replicated stubs hold stale status owned elsewhere).
resolveOrCreateReplicatedUser uses hints.status to seed the new row's
status column. Threaded through every call site (DM participants, group
bootstrap, friend events, ownership transfer). Stub backfill worker also
heals existing rows whose status was stuck at 'offline' from creation.
(2) 'Online' text updates but green avatar dot stays grey on the same page:
spaceStore.updateMemberPresence patches members[] (which feeds space UIs)
but never patches userViews — the cache useCanonicalUserView reads from.
The Avatar in FriendItem reads canonical.status; the text reads
friend.status (socialStore). Two sources, one stale until full
user_updated arrives. Fix: updateMemberPresence now mirrors status into
matching userViews entries, so canonical-view consumers re-render with
fresh status the moment the WS event lands.
This commit is contained in:
@@ -967,6 +967,15 @@ export interface FederationRelayProfileSnapshot {
|
||||
avatarColor?: string | null;
|
||||
banner?: string | null;
|
||||
bio?: string | null;
|
||||
// Current presence at the moment the snapshot was built. Optional for
|
||||
// backwards compatibility with peers that pre-date the field. Receivers use
|
||||
// this to seed the stub's status at creation time, so a freshly-friended
|
||||
// remote user shows their actual current state instead of defaulting to
|
||||
// 'offline' until the next presence_update arrives. presence_update is
|
||||
// ephemeral and fires only on transitions, so without this field an
|
||||
// already-online remote stays stuck at 'offline' on the receiver until they
|
||||
// next change status.
|
||||
status?: 'online' | 'idle' | 'dnd' | 'offline' | null;
|
||||
}
|
||||
|
||||
export interface FederationProfileUpdatePayload {
|
||||
@@ -1077,6 +1086,9 @@ export interface FederationUserLookupProfile {
|
||||
avatarColor: AvatarColor | null;
|
||||
banner: string | null;
|
||||
bio: string | null;
|
||||
// Carried so the requester can seed the stub's status at creation time.
|
||||
// Optional for backwards compat with peers that pre-date the field.
|
||||
status?: 'online' | 'idle' | 'dnd' | 'offline' | null;
|
||||
}
|
||||
|
||||
export type FederationUserLookupResponse =
|
||||
|
||||
Reference in New Issue
Block a user