feat(federation): preserve effective displayName across profile_update relay

FederationProfileUpdatePayload gains `username`: the home user's canonical
handle. Receiver applies displayName ?? username so stubs whose home user has
no displayName show the real handle instead of getting clobbered to null.
Mirrors the existing fallback in hydrateReplicatedUserProfile. Username itself
is immutable on the home instance, so the receiver does not rewrite the stub's
username column on profile_update.
This commit is contained in:
Jannis Braun
2026-05-05 15:48:56 +02:00
parent 1d353c994b
commit 097eb9a2ef
4 changed files with 142 additions and 3 deletions
+2
View File
@@ -362,6 +362,7 @@ export async function userRoutes(app: FastifyInstance): Promise<void> {
homeUserId: preUpdateUser.id,
homeInstance: origin,
profileUpdatedAt: preUpdateUser.profileUpdatedAt ?? Date.now(),
username: preUpdateUser.username,
displayName: preUpdateUser.displayName,
avatar: preUpdateUser.avatar && !preUpdateUser.avatar.startsWith('http')
? `${origin}/api/uploads/${preUpdateUser.avatar}`
@@ -524,6 +525,7 @@ export async function userRoutes(app: FastifyInstance): Promise<void> {
homeUserId: updatedUser!.id,
homeInstance: origin,
profileUpdatedAt: updatedUser!.profileUpdatedAt ?? Date.now(),
username: updatedUser!.username,
displayName: updatedUser!.displayName,
avatar: updatedUser!.avatar && !updatedUser!.avatar.startsWith('http')
? `${origin}/api/uploads/${updatedUser!.avatar}`