-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add the ability to create a workspace for a client #81008
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@QichenZhu Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f5a2049726
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| onSubmit({ | ||
| name: val[INPUT_IDS.NAME], | ||
| currency: val[INPUT_IDS.CURRENCY], | ||
| planType: val[INPUT_IDS.PLAN_TYPE], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Propagate selected plan type into workspace creation
The form now captures planType, but none of the submit handlers downstream use it (e.g., createWorkspaceWithPolicyDraftAndNavigateToIt/Policy.createWorkspace still default the policy type to TEAM unless shouldCreateControlPolicy is set). That means a user can pick “Control” here and still end up with a Team workspace, so the new selector has no effect. Consider threading this value through the submit handlers and into the draft/creation helpers so the chosen plan type actually drives the policy type.
Useful? React with 👍 / 👎.
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
Hey, I noticed you changed If you want to automatically generate translations for other locales, an Expensify employee will have to:
Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running: npx ts-node ./scripts/generateTranslations.ts --helpTypically, you'd want to translate only what you changed by running |
@trjExpensify @QichenZhu Because we added the Plan type selector and Owner selection with the “Keep me as an admin” option, the screen is no longer tall enough to show the Save button.
Could we enable scrolling (or auto-scroll to the bottom) on the workspace confirmation page so the Save button is visible? |
Screen.Recording.2026-02-02.at.11.29.55.mov@trjExpensify @QichenZhu We have a case where the user selects a non-existing account as the Owner. Do we show an error for this case? |
| const {inputCallbackRef} = useAutoFocusInput(); | ||
| const scrollViewRef = useRef<RNScrollView>(null); | ||
| const [account] = useOnyx(ONYXKEYS.ACCOUNT, {canBeMissing: true}); | ||
| const isApprovedAccountant = !!account?.isApprovedAccountant || true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ CONSISTENCY-2 (docs)
The expression \!\!account?.isApprovedAccountant || true will always evaluate to true due to the || true condition. This is a logic bug that defeats the purpose of checking the account status.
Suggested fix:
const isApprovedAccountant = \!\!account?.isApprovedAccountant;If you need to test this feature while it's in development, consider using a feature flag or environment variable instead of hardcoding true.
Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
src/libs/actions/Policy/Policy.ts
Outdated
| const isCorporateIntegration = userReportedIntegration && (CONST.POLICY.CONNECTIONS.CORPORATE as readonly string[]).includes(userReportedIntegration); | ||
| const workspaceType = isCorporateFeature || isCorporateIntegration || shouldCreateControlPolicy ? CONST.POLICY.TYPE.CORPORATE : CONST.POLICY.TYPE.TEAM; | ||
|
|
||
| const determineWorkspaceType = (): typeof CONST.POLICY.TYPE.TEAM | typeof CONST.POLICY.TYPE.CORPORATE => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ PERF-6 (docs)
The determineWorkspaceType helper function is unnecessary. This value can be computed directly without creating a separate function.
Suggested fix:
const workspaceType = type ?? (isCorporateFeature || isCorporateIntegration || shouldCreateControlPolicy ? CONST.POLICY.TYPE.CORPORATE : CONST.POLICY.TYPE.TEAM);This approach:
- Eliminates the helper function
- Uses the nullish coalescing operator for cleaner logic
- Computes the value directly during rendering
- Improves readability
Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
|
I’ll update this tomorrow |
@QichenZhu I don’t think this is a bug, because you had a workspace with the Control plan, so the default type being Control is correct. 😄
|
Screen.Recording.2026-02-06.at.09.32.21.movit's done |
QichenZhu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! It works well overall, but the new components need some cleanup to meet our code standards.
|
@huult where are you at here? |
|
@trjExpensify Yes, I’ll update it today. |
Screen.Recording.2026-02-10.at.11.32.56.mov@QichenZhu Updated. Could you check again? |
|
@codex review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fcd34fa61d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| {isApprovedAccountant && ( | ||
| <> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restrict owner/type fields to flows that save them
This form now shows planType, owner, and makeMeAdmin for every approved accountant (WorkspaceConfirmationForm), but not every caller persists those values: WorkspaceConfirmationForTravelPage.onSubmit still creates the workspace without forwarding params.owner/params.makeMeAdmin (lines 27-38), and IOURequestStepUpgrade.onWorkspaceConfirmationSubmit forwards owner/admin but omits params.planType (lines 161-175). In those flows an approved accountant can choose a client owner or corporate plan and still end up creating a workspace with fallback values, so the UI selection is silently ignored.
Useful? React with 👍 / 👎.
|
@QichenZhu this is ready for re-review. Can you do that today, please? |
|
@trjExpensify, we are stuck on the checklist item (review thread): "If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account." Are we good to skip this check? |
|
Mhm, sounds like the PR is introducing a deprecated |
|
Yeah, there are two issues: first is the |
|
Feel like we need to solve that. @blimpich would you agree? |
|
#81008 (comment) Commented and shared my opinion. |


Explanation of Change
Fixed Issues
$ #80057
PROPOSAL: #80057 (comment)
Tests
Same QA step
Offline tests
QA Steps
Precondition: Set an account as an approved accountant (isApprovedAccountant: true).
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Screen.Recording.2026-02-02.at.11.01.16.mp4
Android: mWeb Chrome
Screen.Recording.2026-02-02.at.11.02.33.mp4
iOS: Native
Screen.Recording.2026-02-02.at.11.07.21.mp4
iOS: mWeb Safari
Screen.Recording.2026-02-02.at.11.08.25.mp4
MacOS: Chrome / Safari
Screen.Recording.2026-02-02.at.10.29.46.mp4