feat: sync user profile to remote instances on federation connect and profile update

This commit is contained in:
Jannis Braun
2026-03-11 01:33:18 +01:00
parent 3790386a5f
commit a5fcb78434
3 changed files with 181 additions and 1 deletions
+6 -1
View File
@@ -6,6 +6,7 @@ import { useSpaceStore } from './spaceStore';
import { useSocialStore } from './socialStore';
import { useVoiceStore } from './voiceStore';
import { useInstanceStore } from './instanceStore';
import { syncProfileUpdateToRemotes } from '../utils/profileSync';
interface AuthState {
token: string | null;
@@ -16,7 +17,7 @@ interface AuthState {
register: (username: string, password: string, displayName?: string) => Promise<void>;
logout: () => void;
loadUser: () => Promise<void>;
updateProfile: (data: { displayName?: string; avatar?: string; banner?: string; accentColor?: string; bio?: string; customStatus?: string; status?: UserStatus }) => Promise<void>;
updateProfile: (data: { displayName?: string; avatar?: string; banner?: string; accentColor?: string; avatarColor?: string; bio?: string; customStatus?: string; status?: UserStatus }) => Promise<void>;
setUser: (user: User) => void;
clearError: () => void;
}
@@ -84,6 +85,10 @@ export const useAuthStore = create<AuthState>((set, get) => ({
try {
const user = await api.users.update(data);
set({ user });
// Push profile changes to all connected remote instances
syncProfileUpdateToRemotes(data).catch((err) => {
console.warn('[ProfileSync] Failed to sync to remotes:', err);
});
} catch (err) {
set({ error: err instanceof Error ? err.message : 'Update failed' });
throw err;