fix: persist homeUserId for federated users to ensure consistent avatar colors
Store the original home snowflake ID (homeUserId) during federation replication so that avatar gradient colors resolve identically across instances. Previously, replicated users got new snowflake IDs on each instance, causing different gradient colors. Now Avatar, UserProfilePopout, VoiceUser, StreamTile, and VoiceChannel all resolve through homeUserId when available. Includes backfill logic for existing federated users missing the field.
This commit is contained in:
@@ -150,6 +150,7 @@ export const useInstanceStore = create<InstanceState>((set, get) => ({
|
||||
password,
|
||||
displayName: displayName || currentUser.displayName || undefined,
|
||||
homeInstance,
|
||||
homeUserId: currentUser.id,
|
||||
});
|
||||
} catch (err) {
|
||||
const message = (err as Error).message;
|
||||
@@ -162,6 +163,7 @@ export const useInstanceStore = create<InstanceState>((set, get) => ({
|
||||
password,
|
||||
displayName: displayName || currentUser.displayName || undefined,
|
||||
homeInstance,
|
||||
homeUserId: currentUser.id,
|
||||
});
|
||||
} catch (err2) {
|
||||
const msg2 = (err2 as Error).message;
|
||||
@@ -380,6 +382,14 @@ export const useInstanceStore = create<InstanceState>((set, get) => ({
|
||||
// Non-critical — keep cached label
|
||||
}
|
||||
|
||||
// Backfill homeUserId if missing (existing federated users before this field existed)
|
||||
if (user.homeInstance && !user.homeUserId) {
|
||||
const homeUser = useAuthStore.getState().user;
|
||||
if (homeUser) {
|
||||
client.users.update({ homeUserId: homeUser.id }).catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
const connectedInstance: ConnectedInstance = {
|
||||
origin,
|
||||
label,
|
||||
|
||||
Reference in New Issue
Block a user