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:
@@ -8,6 +8,7 @@ import { useSettingsStore } from '../stores/settingsStore';
|
||||
import type { ServerEvent, ClientEvent, ActiveCallInfo } from '@backspace/shared';
|
||||
import { resolveAssetUrl, normalizeUserAssets, normalizeMessageAssets } from '../utils/assetUrls';
|
||||
import { broadcastVoiceStatus, broadcastDeafenViaLiveKit } from '../utils/voice';
|
||||
import { registerSelfId } from '../utils/identity';
|
||||
|
||||
// ─── Connection state ─────────────────────────────────────────────────────────
|
||||
|
||||
@@ -88,6 +89,9 @@ function handleEvent(origin: string, event: ServerEvent): void {
|
||||
|
||||
switch (event.type) {
|
||||
case 'ready':
|
||||
// Register this user's ID for cross-instance self-identification
|
||||
registerSelfId(event.user.id);
|
||||
|
||||
if (isHome) {
|
||||
setUser(event.user);
|
||||
useSettingsStore.getState().setIsAdmin(event.user.isAdmin ?? false);
|
||||
|
||||
Reference in New Issue
Block a user