fix: cache federated user identity from WS ready to fix server mute/deafen
getMyUserIdForOrigin relied on instanceStore resolver which could return the home user ID during connection errors. Cache the authoritative user ID directly from the WS ready payload, ensuring effective-state computations use the correct federated identity.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import { useAuthStore } from '../stores/authStore';
|
||||
import { useSpaceStore, getChannelOrigin, getMyUserIdForOrigin } from '../stores/spaceStore';
|
||||
import { useSpaceStore, getChannelOrigin, getMyUserIdForOrigin, setMyUserIdForOrigin } from '../stores/spaceStore';
|
||||
import { useChatStore } from '../stores/chatStore';
|
||||
import { useVoiceStore } from '../stores/voiceStore';
|
||||
import { useSocialStore } from '../stores/socialStore';
|
||||
@@ -109,6 +109,11 @@ function handleEvent(origin: string, event: ServerEvent): void {
|
||||
|
||||
populateFromReady(origin, event.spaces, event.folders, event.dmChannels);
|
||||
|
||||
// Cache authoritative identity for this origin (federation-safe)
|
||||
if (!isHome) {
|
||||
setMyUserIdForOrigin(origin, event.user.id);
|
||||
}
|
||||
|
||||
// Mark remote instance as connected in instanceStore
|
||||
if (!isHome) {
|
||||
import('../stores/instanceStore').then(({ useInstanceStore }) => {
|
||||
|
||||
Reference in New Issue
Block a user