fix: federation DM identity resolution — cross-instance isSelf() failure
Add a cross-instance self-ID registry to identity.ts so isSelf() can recognize the current user's Snowflake IDs from all connected instances. Previously, federated DMs showed the user themselves as the other party because remote-instance IDs didn't match the home user ID. - Register user IDs from every WS ready event (home + remote) - Clear the registry on session reset (login/logout/register/delete) - Fix isSelf() username comparison to parse both sides as federated - Replace naive ID check in MessageList WelcomeHeader with isSelf()
This commit is contained in:
@@ -7,6 +7,7 @@ import { useSocialStore } from '../../stores/socialStore';
|
||||
import { Avatar } from '../ui/Avatar';
|
||||
import { LoadingSpinner } from '../ui/LoadingSpinner';
|
||||
import { hasPermissionBit, PermissionBits } from '../../utils/permissions';
|
||||
import { isSelf } from '../../utils/identity';
|
||||
import type { MessageWithUser } from '@backspace/shared';
|
||||
|
||||
const EMPTY_MESSAGES: MessageWithUser[] = [];
|
||||
@@ -247,7 +248,7 @@ function WelcomeHeader({ channelId }: { channelId: string }) {
|
||||
|
||||
if (isDm) {
|
||||
const dm = dmChannels.find(d => d.id === channelId);
|
||||
const otherUser = dm?.members.find(m => m.id !== authUser?.id);
|
||||
const otherUser = dm?.members.find(m => !isSelf(m, authUser));
|
||||
const displayName = otherUser?.displayName ?? otherUser?.username ?? 'Unknown';
|
||||
const username = otherUser?.username ?? 'unknown';
|
||||
const isFriend = otherUser ? friends.some(f => f.id === otherUser.id) : false;
|
||||
|
||||
Reference in New Issue
Block a user