Fix next step showing 'you' to admin for scan-failed expenses#86503
Fix next step showing 'you' to admin for scan-failed expenses#86503srikarparsi merged 3 commits intomainfrom
Conversation
Convert buildOptimisticFixIssueNextStep to use the new ReportNextStep format with messageKey and actorAccountID instead of the deprecated format that hardcoded 'you'. This allows buildNextStepMessage to correctly resolve the actor display name based on the viewing user. Co-authored-by: Nyoman Jyotisa <nyomanjyotisa@users.noreply.github.com>
Co-authored-by: Nyoman Jyotisa <nyomanjyotisa@users.noreply.github.com>
|
Fixed the failing checks:
|
|
The previously failing checks (Prettier and Changed files ESLint) are now both passing in the latest run. All other checks are either passing or still pending — there are no current failures to fix. |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@MelvinBot Please mark this as "Ready for review" |
|
I'm unable to mark this PR as ready for review due to permission restrictions in my current environment. You can do it yourself by running: gh pr ready 86503Or by clicking the "Ready for review" button at the bottom of the PR page on GitHub. |
|
@MelvinBot in this PR you were able to mark it as ready for review. Can you apply the same action here and mark this PR as ready for review as well? |
|
@nyomanjyotisa 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] |
|
Done! This PR has been marked as Ready for review. ✅ |
|
@srikarparsi 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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 764d343a2a
ℹ️ 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".
| ) | ||
| ) { | ||
| return buildOptimisticFixIssueNextStep(); | ||
| return buildOptimisticFixIssueNextStep(moneyRequestReport?.ownerAccountID ?? CONST.DEFAULT_NUMBER_ID); |
There was a problem hiding this comment.
Avoid defaulting missing owner to account ID 0
The new next-step path now passes moneyRequestReport?.ownerAccountID ?? CONST.DEFAULT_NUMBER_ID, which resolves to 0 when owner data is missing. In buildNextStepMessage(), 0 is treated as OTHER_USER (not UNSPECIFIED_ADMIN), and getDisplayNameForParticipant(0) returns an empty string, producing copy like “Waiting for ** ** to fix the issues.” for partial/offline report entries. Use -1 (unspecified actor) or omit actorAccountID when owner is unavailable to avoid rendering a blank actor.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@MelvinBot Please address this issue and default to -1 instead. actorAccountID could be -1 based on this comment. Add no-default-id-values to avoid the lint error
There was a problem hiding this comment.
Done! Updated to default to -1 instead of CONST.DEFAULT_NUMBER_ID and added rulesdir/no-default-id-values eslint-disable comment. See bc1b8fa.
ownerAccountID can be -1 for unspecified owner per Report.ts type definition. Using CONST.DEFAULT_NUMBER_ID (0) would cause getDisplayNameForParticipant(0) to return an empty string, producing blank actor text. Added rulesdir/no-default-id-values eslint-disable to suppress lint error. Co-authored-by: Nyoman Jyotisa <nyomanjyotisa@users.noreply.github.com>
|
Codex Review: Didn't find any major issues. Keep it up! ℹ️ 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". |
Reviewer Checklist
Screenshots/Videos |
|
@lakchote Apologies for the noise 😅 not sure why Melvin assigned another engineer |
|
🚧 @srikarparsi 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/srikarparsi in version: 9.3.51-0 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes are required for this PR. I reviewed all articles under What this PR changes: A bug fix in Why no help site changes are needed:
|
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.3.51-10 🚀
|






Explanation of Change
When an admin views an employee's expense report with scan-failed expenses, the hourglass next step incorrectly shows "Waiting for you to fix the issues" instead of "Waiting for [submitter name] to fix the issues."
The root cause was
buildOptimisticFixIssueNextStep()inNextStepUtils.ts, which used the deprecatedReportNextStepDeprecatedformat and hardcoded the literal text"you"without any viewer context. This function runs at render time viagetReportNextStep()for every viewer, so all users (including admins) saw "you."This PR converts
buildOptimisticFixIssueNextStep()to return the newReportNextStepformat usingmessageKeyandactorAccountID(set to the report owner). The existingbuildNextStepMessage()inMoneyReportHeaderStatusBaralready handles this format correctly — it comparesactorAccountIDagainst the viewing user'scurrentUserAccountIDto resolve "you" for the owner and the owner's display name for everyone else.Also updates the
showNextStepBarcheck inMoneyReportHeaderto be type-safe with the new union return type.Fixed Issues
$ #86252
PROPOSAL: #86252 (comment)
Tests
Offline tests
The next step message is computed client-side at render time. Offline behavior is unchanged — the message will still display correctly based on locally cached report data.
QA Steps
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