fix: resolve federated avatar color to home instance identity
Federated users get a different snowflake ID on remote instances, causing avatar gradients to mismatch their home identity. Apply resolveDisplayIdentity/isSelf resolution in VoiceUser, StreamTile, VoiceChannel sidebar, and MemberSidebar so the current user's avatar color is consistent across all views.
This commit is contained in:
@@ -2,6 +2,8 @@ import React, { useMemo } from 'react';
|
||||
import type { MemberWithUser } from '@backspace/shared';
|
||||
import { useServerStore } from '../../stores/serverStore';
|
||||
import { useUIStore } from '../../stores/uiStore';
|
||||
import { useAuthStore } from '../../stores/authStore';
|
||||
import { resolveDisplayIdentity } from '../../utils/identity';
|
||||
import { Avatar } from '../ui/Avatar';
|
||||
import { Username } from '../ui/Username';
|
||||
|
||||
@@ -46,6 +48,7 @@ export function MemberSidebar() {
|
||||
const currentServerId = useServerStore((s) => s.currentServerId);
|
||||
const memberListOpen = useUIStore((s) => s.memberListOpen);
|
||||
const openUserProfile = useUIStore((s) => s.openUserProfile);
|
||||
const authUser = useAuthStore((s) => s.user);
|
||||
|
||||
const server = servers.find(s => s.id === currentServerId);
|
||||
const ownerId = server?.ownerId;
|
||||
@@ -97,6 +100,7 @@ export function MemberSidebar() {
|
||||
const renderMember = (member: MemberWithUser, isOffline = false) => {
|
||||
const displayName = member.user.displayName ?? member.user.username;
|
||||
const colorStyle = isOffline ? undefined : getMemberColor(member);
|
||||
const resolvedUser = resolveDisplayIdentity(member.user, authUser ?? null);
|
||||
return (
|
||||
<div
|
||||
key={member.userId}
|
||||
@@ -110,6 +114,7 @@ export function MemberSidebar() {
|
||||
status={isOffline ? 'offline' : member.user.status}
|
||||
className={isOffline ? 'opacity-60' : undefined}
|
||||
user={member.user}
|
||||
userId={resolvedUser.id}
|
||||
/>
|
||||
<div className="flex-1 min-w-0">
|
||||
<Username
|
||||
|
||||
Reference in New Issue
Block a user