Roo-Code/packages/cloud
Matt Rubens abaa3d8179
Store the organization id in credentials (#5002)
* Store the organization id in credentials

* Better organization logic

* Fix tests

* Update cloud settings defaults

* Fix organization_id handling in Clerk API calls

Address review feedback by properly handling 3 cases for organization_id:
1. Have an org id: send organization_id=THE_ORG_ID
2. Have a personal account: send organization_id= (empty string)
3. Don't know if you have an org id (old credentials): don't send organization_id param at all

Changes:
- Updated clerkCreateSessionToken() to check credentials.organizationId !== undefined
- Updated fetchUserInfo() to handle all 3 cases consistently
- Added fallback logic for old credentials without organization context
- Improved logging for better debugging of organization context

* DRY up organization loading code in AuthService

Extract common organization membership processing logic into reusable helper methods:

- findOrganizationMembership(): Find specific org membership by ID
- findPrimaryOrganizationMembership(): Get first/primary org membership
- setUserOrganizationInfo(): Set organization info on user object

This eliminates duplication between the two clerkGetOrganizationMemberships()
call sites that were doing very similar organization data processing.
2025-06-23 07:23:29 -04:00
..
src Store the organization id in credentials (#5002) 2025-06-23 07:23:29 -04:00
eslint.config.mjs Roo Code Cloud (#4069) 2025-05-28 20:43:30 -07:00
package.json Farewell jest (#4607) 2025-06-16 21:39:45 -07:00
tsconfig.json Roo Code Cloud (#4069) 2025-05-28 20:43:30 -07:00
vitest.config.ts Convert jest tests to vitest and disable default watch mode for vitest (#4568) 2025-06-11 14:48:01 -07:00