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:
Jannis Braun
2026-03-12 18:53:38 +01:00
parent 83699d7e91
commit 8af155d08f
4 changed files with 26 additions and 2 deletions
+2
View File
@@ -8,6 +8,7 @@ import { useVoiceStore } from './voiceStore';
import { useInstanceStore } from './instanceStore';
import { syncProfileUpdateToRemotes } from '../utils/profileSync';
import { changePasswordOnRemotes, deleteAccountOnRemotes, type FederationOpResult } from '../utils/federationOps';
import { clearSelfIds } from '../utils/identity';
interface AuthState {
token: string | null;
@@ -27,6 +28,7 @@ interface AuthState {
/** Reset all user-scoped stores to prevent data leaking between sessions */
function resetUserStores() {
clearSelfIds();
useChatStore.getState().clearAllMessages();
useSpaceStore.getState().populateFromReady('', [], [], []);
useSocialStore.getState().reset();