Roo-Code/packages
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
..
build Farewell jest (#4607) 2025-06-16 21:39:45 -07:00
cloud Store the organization id in credentials (#5002) 2025-06-23 07:23:29 -04:00
config-eslint Upgrade to ESLint 9 + share eslint config across workspaces (#3815) 2025-05-21 21:30:21 -07:00
config-typescript Roo Code Cloud (#4069) 2025-05-28 20:43:30 -07:00
evals Update evals Docker setup to work on Windows. (#4656) 2025-06-17 11:23:43 -07:00
ipc Farewell jest (#4607) 2025-06-16 21:39:45 -07:00
telemetry fix(deps): update dependency posthog-node to v5 (#4805) 2025-06-19 00:52:40 -07:00
types Store the organization id in credentials (#5002) 2025-06-23 07:23:29 -04:00