You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-05-07] Show action badge (Approve) in LHN for individual expense reports #87712
The "action badge" (e.g., Approve) currently only shows in the LHN (Left Hand Navigation) on the workspace chat. It does not appear when viewing an individual expense report directly.
Expected Behavior
The action badge should appear in the LHN entry for individual expense reports — not just workspace chats.
The badge should always show Approve as the action text, even when the actual button displayed is Review duplicates.
The action badge in the LHN is computed via getReasonAndReportActionThatRequiresAttention() in ReportUtils.ts, which calls getIOUReportActionWithBadge()
getIOUReportActionWithBadge() searches the report's own actions for a REPORT_PREVIEW action and then checks whether the linked child expense report can be approved/paid/submitted. The problem is that REPORT_PREVIEW actions only exist in workspace chat reports (the parent chat that previews an expense report). When an individual expense report appears in the LHN, it has no REPORT_PREVIEW actions in its own action list, it is the expense report being previewed elsewhere. So the function finds nothing and returns no badge.
so the badge logic assumes every LHN entry is a chat report with child expense previews, but never handles the case where the LHN entry is the expense report itself.
What changes do you think we should make in order to solve the problem?
In getReasonAndReportActionThatRequiresAttention() before calling getIOUReportActionWithBadge(), add a check if the report itself is an expense report isExpenseReport(optionOrReport), directly evaluate canApproveIOU() / canIOUBePaid() / canSubmitAndIsAwaitingForCurrentUser() on the report and return the appropriate badge without needing to find a REPORT_PREVIEW action.
If isExpenseReport(optionOrReport) is true, call canApproveIOU(optionOrReport, policy, optionReportMetadata) — if it returns true, set actionBadge = APPROVE.
Else check canIOUBePaid(optionOrReport, chatReport, policy, ...) > if true, set actionBadge = PAY.
Else check canSubmitAndIsAwaitingForCurrentUser(...) > if true, set actionBadge = SUBMIT.
Per the issue requirement, when the actual UI button would show "Review duplicates", the badge text should still read Approve this is already satisfied because canApproveIOU() returns true for reports needing approval regardless of whether duplicates exist, so the badge will correctly say Approve.
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
📣 @Vanshikadahaliya! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
getReasonAndReportActionThatRequiresAttention delegates badge computation to getIOUReportActionWithBadge (ReportWorkflow.ts:265), which searches the report's own actions for a REPORT_PREVIEW action and then evaluates whether the linked child expense report can be paid/approved/submitted. REPORT_PREVIEW actions only exist in workspace chat reports (they are the parent-side preview of a child expense report). When the LHN entry is the expense report itself, it contains no REPORT_PREVIEW actions, so getIOUReportActionWithBadge returns no match and no badge.
What changes do you think we should make in order to solve the problem?
In getReasonAndReportActionThatRequiresAttention (ReportUtils.ts:4308), before calling getIOUReportActionWithBadge, add a short-circuit for expense reports: if isExpenseReport(optionOrReport) is true, directly evaluate canIOUBePaid/canApproveIOU/canSubmitAndIsAwaitingForCurrentUser on the report itself (it is the IOU report) using getReportOrDraftReport(optionOrReport.chatReportID) as the parent chat, and return the appropriate badge without needing a REPORT_PREVIEW action. The priority order (pay > approve > submit) should match what getIOUReportActionWithBadge already uses. Per the issue requirement, "Review duplicates" cases still get an Approve badge because canApproveIOU returns true regardless of duplicate state.
What alternative solutions did you explore? (Optional)
Modifying getIOUReportActionWithBadge itself to handle expense reports was considered, but that function's contract is to return a specific reportAction (the REPORT_PREVIEW action) alongside the badge. For expense reports there is no such action to return, so adding the logic in the caller (getReasonAndReportActionThatRequiresAttention) is a cleaner separation.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: new feature
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Activity
samranahm commentedon Apr 11, 2026
Proposal
What is the root cause of that problem?
The action badge in the LHN is computed via
getReasonAndReportActionThatRequiresAttention()inReportUtils.ts, which callsgetIOUReportActionWithBadge()getIOUReportActionWithBadge()searches the report's own actions for aREPORT_PREVIEWaction and then checks whether the linked child expense report can be approved/paid/submitted. The problem is thatREPORT_PREVIEWactions only exist in workspace chat reports (the parent chat that previews an expense report). When an individual expense report appears in the LHN, it has noREPORT_PREVIEWactions in its own action list, it is the expense report being previewed elsewhere. So the function finds nothing and returns no badge.so the badge logic assumes every LHN entry is a chat report with child expense previews, but never handles the case where the LHN entry is the expense report itself.
What changes do you think we should make in order to solve the problem?
In
getReasonAndReportActionThatRequiresAttention()before callinggetIOUReportActionWithBadge(), add a check if the report itself is an expense reportisExpenseReport(optionOrReport), directly evaluatecanApproveIOU()/canIOUBePaid()/canSubmitAndIsAwaitingForCurrentUser()on the report and return the appropriate badge without needing to find aREPORT_PREVIEWaction.Specifically:
isExpenseReport(optionOrReport)is true, callcanApproveIOU(optionOrReport, policy, optionReportMetadata)— if it returns true, setactionBadge = APPROVE.canIOUBePaid(optionOrReport, chatReport, policy, ...)> if true, setactionBadge = PAY.canSubmitAndIsAwaitingForCurrentUser(...)> if true, setactionBadge = SUBMIT.canApproveIOU()returns true for reports needing approval regardless of whether duplicates exist, so the badge will correctly say Approve.What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Vanshikadahaliya commentedon Apr 13, 2026
Hi, I would like to work on this issue. Can you please assign it to me?
melvin-bot commentedon Apr 13, 2026
📣 @Vanshikadahaliya! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format:
Vanshikadahaliya commentedon Apr 13, 2026
Contributor details
Your Expensify account email: vanshikad0023@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~0138f8dc915519337d
melvin-bot commentedon Apr 13, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
melvin-bot commentedon Apr 14, 2026
@aimane-chnaif Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
melvin-bot commentedon Apr 16, 2026
@aimane-chnaif Eep! 4 days overdue now. Issues have feelings too...
aimane-chnaif commentedon Apr 19, 2026
@MelvinBot post your proposal
MelvinBot commentedon Apr 19, 2026
Proposal
What is the root cause of that problem?
getReasonAndReportActionThatRequiresAttentiondelegates badge computation togetIOUReportActionWithBadge(ReportWorkflow.ts:265), which searches the report's own actions for aREPORT_PREVIEWaction and then evaluates whether the linked child expense report can be paid/approved/submitted.REPORT_PREVIEWactions only exist in workspace chat reports (they are the parent-side preview of a child expense report). When the LHN entry is the expense report itself, it contains noREPORT_PREVIEWactions, sogetIOUReportActionWithBadgereturns no match and no badge.What changes do you think we should make in order to solve the problem?
In
getReasonAndReportActionThatRequiresAttention(ReportUtils.ts:4308), before callinggetIOUReportActionWithBadge, add a short-circuit for expense reports: ifisExpenseReport(optionOrReport)is true, directly evaluatecanIOUBePaid/canApproveIOU/canSubmitAndIsAwaitingForCurrentUseron the report itself (it is the IOU report) usinggetReportOrDraftReport(optionOrReport.chatReportID)as the parent chat, and return the appropriate badge without needing aREPORT_PREVIEWaction. The priority order (pay > approve > submit) should match whatgetIOUReportActionWithBadgealready uses. Per the issue requirement, "Review duplicates" cases still get an Approve badge becausecanApproveIOUreturns true regardless of duplicate state.What alternative solutions did you explore? (Optional)
Modifying
getIOUReportActionWithBadgeitself to handle expense reports was considered, but that function's contract is to return a specificreportAction(theREPORT_PREVIEWaction) alongside the badge. For expense reports there is no such action to return, so adding the logic in the caller (getReasonAndReportActionThatRequiresAttention) is a cleaner separation.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.aimane-chnaif commentedon Apr 19, 2026
@MelvinBot implement this
MelvinBot commentedon Apr 19, 2026
Draft PR created: #88294
Please mark it as "Ready for review" when it is ready for review.
12 remaining items
aimane-chnaif commentedon May 1, 2026
BugZero Checklist:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: new feature
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/634722
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-40fe-a28f-71b1-0d04c36b33d4melvin-bot commentedon May 6, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon May 7, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon May 8, 2026
Payment Summary
Contributor+: @aimane-chnaif paid $250 via Upwork
@aimane-chnaif can you please accept the job below? Please reply here and tag me once you have.
https://www.upwork.com/jobs/~022052539212036214369
aimane-chnaif commentedon May 8, 2026
@mallenexpensify accepted offer
mallenexpensify commentedon May 9, 2026
@aimane-chnaif paid, summary updated above. Thx.