Repository navigation
Allow to create reports in submit2026 workspaces - #92241
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f68b2a5b84
ℹ️ 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".
| */ | ||
| function getDefaultChatEnabledPolicy(groupPoliciesWithChatEnabled: Array<OnyxInputOrEntry<Policy>>, activePolicy?: OnyxInputOrEntry<Policy> | null): OnyxInputOrEntry<Policy> | undefined { | ||
| if (activePolicy && activePolicy.isPolicyExpenseChatEnabled && isPaidGroupPolicy(activePolicy)) { | ||
| if (activePolicy && activePolicy.isPolicyExpenseChatEnabled && isGroupPolicy(activePolicy)) { |
There was a problem hiding this comment.
Gate active Submit policies before defaulting
When the active workspace is a Submit policy but the user is not in SUBMIT_2026, this now returns that active policy even though callers just filtered groupPoliciesWithChatEnabled through getGroupPoliciesWhereReportCanBeCreated. For a user who has an active Submit workspace plus any eligible paid workspace, the report buttons will create the report in the beta-gated Submit workspace instead of using the eligible paid workspace or showing the selector; keep the active-policy default aligned with the same Submit beta eligibility as the list.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
No need since users won't be able to create the workspace if they are not in the beta
| const result: OnyxTypes.Policy[] = []; | ||
| for (const policy of Object.values(policies)) { | ||
| if (!policy?.isPolicyExpenseChatEnabled || policy?.isJoinRequestPending || !isPaidGroupPolicy(policy) || !shouldShowPolicy(policy, false, currentUserLogin)) { | ||
| if (!policy?.isPolicyExpenseChatEnabled || policy?.isJoinRequestPending || !isGroupPolicy(policy) || !shouldShowPolicy(policy, false, currentUserLogin)) { |
There was a problem hiding this comment.
Keep the FAB selector beta-aware
This FAB-specific selector now includes every Submit workspace because isGroupPolicy() does not check SUBMIT_2026. In the FAB flow, a non-beta user with only a Submit workspace will have groupPoliciesWithChatEnabled.length > 0, so useCreateReport skips the upgrade path and can create a report in a workspace whose Submit features should still be gated; use the new beta-aware helper here as in the other create-report entry points.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
No need since users won't be able to create the workspace if they are not in the beta
| const groupPaidPoliciesWithChatEnabledSelector = useCallback((policies: OnyxCollection<OnyxTypes.Policy>) => groupPaidPoliciesWithExpenseChatEnabledSelector(policies, email), [email]); | ||
| const [groupPoliciesWithChatEnabled = CONST.EMPTY_ARRAY] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {selector: groupPaidPoliciesWithChatEnabledSelector}, [email]); | ||
| const isSubmit2026BetaEnabled = isBetaEnabled(CONST.BETAS.SUBMIT_2026); | ||
| const groupPoliciesWithChatEnabledSelector = useCallback( |
There was a problem hiding this comment.
❌ CLEAN-REACT-PATTERNS-0 (docs)
React Compiler is enabled and this file compiles successfully. The useCallback wrapping the selector is redundant because the compiler automatically memoizes closures based on their captured variables (isSubmit2026BetaEnabled, email).
Remove the useCallback wrapper and define the selector as a plain function expression:
const groupPoliciesWithChatEnabledSelector = (policies: OnyxCollection<OnyxTypes.Policy>) => getGroupPoliciesWhereReportCanBeCreated(policies, isSubmit2026BetaEnabled, email);Reviewed at: f68b2a5 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
| const currentUserPersonalDetails = useCurrentUserPersonalDetails(); | ||
| const {isBetaEnabled} = usePermissions(); | ||
| const isASAPSubmitBetaEnabled = isBetaEnabled(CONST.BETAS.ASAP_SUBMIT); | ||
| const isSubmit2026BetaEnabled = isBetaEnabled(CONST.BETAS.SUBMIT_2026); |
There was a problem hiding this comment.
❌ CLEAN-REACT-PATTERNS-0 (docs)
React Compiler is enabled and this file compiles successfully. The useCallback wrapping the selector is redundant because the compiler automatically memoizes closures based on their captured variables (isSubmit2026BetaEnabled, email).
Remove the useCallback wrapper and define the selector as a plain function expression:
const groupPoliciesWithChatEnabledSelector = (policies: OnyxCollection<OnyxTypes.Policy>) => getGroupPoliciesWhereReportCanBeCreated(policies, isSubmit2026BetaEnabled, email);Reviewed at: f68b2a5 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
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.
|
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b7e6699317
ℹ️ 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".
| */ | ||
| function getDefaultChatEnabledPolicy(groupPoliciesWithChatEnabled: Array<OnyxInputOrEntry<Policy>>, activePolicy?: OnyxInputOrEntry<Policy> | null): OnyxInputOrEntry<Policy> | undefined { | ||
| if (activePolicy && activePolicy.isPolicyExpenseChatEnabled && isPaidGroupPolicy(activePolicy)) { | ||
| if (activePolicy && activePolicy.isPolicyExpenseChatEnabled && isGroupPolicy(activePolicy)) { |
There was a problem hiding this comment.
Gate the active policy by the Submit beta
When SUBMIT_2026 is disabled, the updated callers build groupPoliciesWithChatEnabled with getGroupPoliciesWhereReportCanBeCreated(..., false), which excludes Submit workspaces, but this branch still returns the active workspace because isGroupPolicy() includes Submit unconditionally. With a Submit workspace selected, the create-report flows then use this defaultChatEnabledPolicy to call createNewReport, bypassing the intended beta gate. Please apply the same Submit-beta check to the active-policy path (or require the active policy to be present in the already filtered list).
Useful? React with 👍 / 👎.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppScreen.Recording.2026-06-02.at.18.50.32.moviOS: mWeb SafariScreen.Recording.2026-06-02.at.18.47.50.movMacOS: Chrome / SafariScreen.Recording.2026-06-02.at.18.45.35.mov |
|
@Gonals all yours |
|
@Gonals bump! |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 @Gonals has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/Gonals in version: 9.4.0-0 🚀
Bundle Size Analysis (Sentry): |
|
🤖 No help site changes required — no draft PR created. I reviewed the changes in this PR against the help articles under Why: This PR's user-facing behavior (allowing report creation in Submit workspaces) is entirely gated behind the Supporting evidence
If the cc @iwiznia — flagging since you requested the review. Let me know if you'd like a docs PR drafted anyway (e.g., to pre-stage content behind the beta launch). |
|
Deploy Blocker #92862 was identified to be related to this PR. |
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.4.0-7 🚀
|
Explanation of Change
Allows creating reports in the submit2026 workspaces
Fixed Issues
$#91991
$#91992
$#91993
PROPOSAL:
Tests
Offline tests
No
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand 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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari