- Ya
- 8 Julai 2026, 21:51 UTC
- Mwandishi
- Kamo
- Ahadi ya
- e97fc05
Switching an org to Microsoft 365 (or Google Workspace / Zoho) never stuck: the OAuth callback stored tokens and only flipped status on a pre-existing provider row, never writing provider_type and no-op'ing entirely when the org had no row. The read path then fell back to the hard-coded KAMO_MAIL default, so the settings page reverted. Upsert the org_email_providers row with the provider carried in the OAuth state and mark it ACTIVE. Adds OAuthFlowServiceTest covering the no-row and KamoMail-row cases.