Repository navigation
Guard report title editing when policy has no title field - #91159
Conversation
When a policy's fieldList contains other report fields but lacks text_title, canEditReportTitle returned true because isReportFieldDisabled(report, undefined, policy) falls through to false. This caused the edit button to appear, leading to "It's not here" on EditReportFieldPage. Two changes: 1. getTitleFieldWithFallback now always returns FALLBACK_TITLE_FIELD when the policy has no title field, instead of only when the entire fieldList is empty. This matches OldDot behavior and lets users edit report titles on policies with custom fields but no title field. 2. canEditReportTitle now falls back to getTitleFieldWithFallback and guards on the result, keeping the affordance check in sync with the edit page. Co-authored-by: Aimane Chnaif <aimane-chnaif@users.noreply.github.com>
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Co-authored-by: Aimane Chnaif <aimane-chnaif@users.noreply.github.com>
|
Fixed the failing ESLint check: removed the unused |
Code ReviewThe fix correctly addresses the bug: when a policy has custom fields but no Two minor items:
Neither is blocking. The logic is correct, all callers handle the change safely, and checks are passing. 👍 |
|
Codex Review: Didn't find any major issues. Another round soon, please! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
@MelvinBot fix this |
Co-authored-by: aimane-chnaif <aimane.chnaif@gmail.com> Co-authored-by: Aimane Chnaif <aimane-chnaif@users.noreply.github.com>
|
Fixed both items from the review:
All 960 ReportUtils tests pass, typecheck clean. |
|
@MelvinBot add unit test |
|
All CI checks are passing. The only failing check is the PR Author Checklist, which requires manual completion — it's not a code issue. No fix is needed. |
|
@MelvinBot add QA Steps and complete checklist |
…allback behavior Co-authored-by: aimane-chnaif <aimane.chnaif@gmail.com> Co-authored-by: Aimane Chnaif <aimane-chnaif@users.noreply.github.com>
|
Added unit tests in a3e78bb:
All 11 tests (7 existing + 4 new) pass locally. |
|
Updated the PR body with:
Please review the test/QA steps and adjust if needed before marking as ready for review. |
|
@MelvinBot check off all remaining items. They're verified. |
|
✅ All remaining checklist items have been checked off as verified by |
|
@MelvinBot mark as ready for review |
Regression AnalysisNo regressions found in the core fix. The 1. Latent inconsistency in
|
|
✅ Done — this PR has been marked as ready for review. |
|
@aimane-chnaif 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] |
Rename 'policy' to 'testPolicyData' in getTitleFieldWithFallback tests to avoid shadowing the outer scope variable. Pin role to ADMIN in the 'not a paid group policy' test so canEditReportTitle always reaches isPaidGroupPolicy, preventing mockReturnValueOnce(false) from leaking into subsequent tests. Co-authored-by: Aimane Chnaif <aimane-chnaif@users.noreply.github.com>
|
Fixed both failing checks:
|
|
@tylerkaraszewski 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] |
|
All checks are now passing on this PR. The earlier ESLint failure was resolved by a subsequent commit, and all current checks (ESLint, TypeScript, Jest tests, perf-tests, Storybook, etc.) have completed successfully. No fix was needed. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid.movAndroid: mWeb ChromeiOS: HybridAppios.moviOS: mWeb SafariMacOS: Chrome / Safariweb.mov |
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Good for product
|
🚧 @tylerkaraszewski 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! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/tylerkaraszewski in version: 9.3.79-1 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes are required for this PR. This is a code-only bug fix in |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.3.79-4 🚀
|
Explanation of Change
canEditReportTitlereturnedtrueeven when the policy'sfieldListcontained notext_titleentry, becauseisReportFieldDisabled(report, undefined, policy)falls through tofalse. This caused the edit button to appear, and clicking it navigated toEditReportFieldPagewhich showed "It's not here" sincegetTitleFieldWithFallbackonly returned the fallback title field when the entirefieldListwas empty — not when the title field was specifically missing among other custom fields.Two changes in
ReportUtils.ts:getTitleFieldWithFallback: Always returnFALLBACK_TITLE_FIELDwhen the policy has notext_title, instead of only when the entirefieldListis empty. This matches OldDot behavior and lets users edit report titles on policies with custom fields but no title field.canEditReportTitle: Fall back togetTitleFieldWithFallbackwhen the available report fields don't include a title field, and guard on the result. This keeps the affordance check in sync with the edit page.Fixed Issues
$ #84555
PROPOSAL: #84555 (comment)
Tests
text_titlefield configured, verify editing the report title still works as beforeOffline tests
N/A — this is a pure guard clause on a boolean function. No network requests are involved.
QA Steps
text_title)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
All platforms
N/A — logic-only change with no UI modifications
AI Tests
npm run lint-changednpm run typecheck-tsgonpm test -- --testPathPattern=ReportUtils