mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-11-01 00:13:37 +00:00
With multiple accounts and settings sync on, the composer's default sender would switch depending on login order and get disturbed by logging a third account off. Cause: the per-account maps preferredIdentityIds (#507) and allMailFolderIds live in EVERY account's synced settings blob, and loadFromServer(username, serverUrl) runs once per connected account calling importSettings(), which REPLACED the whole map with that account's server copy. So the last account to load clobbered the map (last-writer-wins by login order), and a stale blob from a since-removed account could win too. Fix: importSettings takes an optional { serverAccountId }; loadFromServer passes generateAccountId(username, serverUrl). For the per-account maps, a server load now merges only that account's OWN entry into the existing map instead of replacing it - each account's server is authoritative only for itself, so other accounts' entries survive. File imports (no serverAccountId) still replace wholesale. + regression tests: a per-account load preserves other accounts' entries, only trusts the loading account, file import still replaces, same for allMailFolderIds. tsc + eslint clean.