fix: clean up replicatedInstances and registry on federation identity deletion

After deleting a federated identity, the server-side user_federation_registry
and users.replicated_instances were not cleaned up, causing "already connected"
errors when trying to re-federate. The deletion endpoint now authoritatively
removes both the registry row and the replicatedInstances entry, and bumps the
LWW timestamp to prevent stale client syncs from re-inserting them.

Also extends the endpoint to accept mode 'leave' (skip S2S, just clean up),
and enables the "Select instances..." scope option in DeleteIdentityDialog.
This commit is contained in:
Jannis Braun
2026-04-03 04:56:25 +02:00
parent 58c6ec1dc6
commit 02a44c201d
4 changed files with 129 additions and 65 deletions
-9
View File
@@ -704,15 +704,6 @@ export const useInstanceStore = create<InstanceState>((set, get) => ({
},
deleteIdentity: async (origins: string[], mode: 'leave' | 'soft' | 'full' = 'leave') => {
// Leave mode: client-only cleanup, no server call
if (mode === 'leave') {
for (const origin of origins) {
get().forceRemoveEntry(origin);
}
return Object.fromEntries(origins.map(o => [o, { success: true as const }]));
}
// Soft/full mode: S2S relay via home instance
try {
const { results } = await api.users.deleteFederationIdentity({ origins, mode });