fix: sync identity stores and append signatures to outgoing emails (#15)

- Add syncIdentities() to auth store to propagate identity changes from
  identity store, fixing stale data that caused save failures and duplicates
- Call syncIdentities() after every create, update, and delete in the
  identity manager modal
- Switch email composer to read identities from identity store for
  consistency with the rest of the app
- Append identity text signature (with RFC 3676 separator) to email body
  when sending from the composer and quick reply paths
- Add tests for syncIdentities and signature appending logic
This commit is contained in:
Linus Rath
2026-03-15 16:07:45 +01:00
parent 5643170220
commit 0080d27b3e
6 changed files with 214 additions and 3 deletions
+8
View File
@@ -33,6 +33,7 @@ interface AuthState {
logout: () => void;
checkAuth: () => Promise<void>;
clearError: () => void;
syncIdentities: () => void;
}
const ERROR_PATTERNS: Array<{ key: string; matches: string[] }> = [
@@ -479,6 +480,13 @@ export const useAuthStore = create<AuthState>()(
},
clearError: () => set({ error: null }),
syncIdentities: () => {
const identityState = useIdentityStore.getState();
const identities = identityState.identities;
const primaryIdentity = identities[0] ?? null;
set({ identities, primaryIdentity });
},
}),
{
name: 'auth-storage',