Skip to content

[$250] [Due for payment 2026-04-17] LHN - Negative expenses show "Mark as paid" action but "Pay" badge is not visible on LHN. #85187

Closed

Description

@mitarachim

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.3.37.0
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #85025
Email or phone of affected tester (no customers): ibellicotest+2250@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Motorola MotoG60 / Android 12 (Hybrid app) - Windows 11 / Chrome
App Component: Left Hand Navigation (LHN)

Action Performed:

Prerequisite: Account has at least one workspace.
Prerequisite 2: Delayed submissions, approvals and payments enabled.

  1. Open the staging.new.expensify.com website.
  2. Open workspace chat.
  3. Create a manual expense with negative amount.
  4. Submit and approve the expense.
  5. Note that expense preview shows "Mark as paid" action.
  6. Note that no "Pay" action badge is visible on chat preview on LHN.

Expected Result:

"Pay" action badge should be visible on chat preview on LHN for expenses with negative amount, as expense displays the "Mark as paid" action.

Actual Result:

"Pay" action badge is not displayed on chat preview on LHN for expenses with negative amount, despite expense displaying a "Mark as paid" action.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Bug7101784_1773374533796.Badge_Negative.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @mallenexpensify
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022045485815877973993
  • Upwork Job ID: 2045485815877973993
  • Last Price Increase: 2026-04-18

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    DeployBlockerIndicates it should block deploying the API
    on Mar 13, 2026
  2. melvin-bot commented on Mar 13, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #85025

  3. melvin-bot commented on Mar 13, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  4. github-actions commented on Mar 13, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  5. OSBotify commented on Mar 13, 2026

    @OSBotify
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #85025 - "feat: Expand GBR/RBR with an action badge" by @aimane-chnaif (High confidence)

    Recommendation: REVERT

    PR #85025 introduced a new action badge feature for the LHN (Left Hand Navigation) that shows text badges like "Submit", "Approve", and "Pay" instead of colored dots. However, the implementation did not account for negative expenses that show a "Mark as paid" action.

    Root Cause: The function getIOUReportActionWithBadge (src/libs/actions/IOU/index.ts:9805) calls canIOUBePaid with onlyShowPayElsewhere=false (default), which returns false for negative amounts. For negative expenses, the "Mark as paid" action is only shown when onlyShowPayElsewhere=true, but the badge logic does not check this condition.

    Labels: This is a frontend bug - the issue is caused by App PR #85025 and the fix requires changes to App code. No backend changes needed. Keeping DeployBlockerCash label, removing DeployBlocker label.

    📋 Detailed Analysis

    Evidence

    Verification

    • Affected files:

      • src/libs/actions/IOU/index.ts - Contains the getIOUReportActionWithBadge function
      • src/components/LHNOptionsList/OptionRowLHN.tsx - Renders the action badge in LHN
    • PR feat: Expand GBR/RBR with an "action badge" #85025 modifies these files: Confirmed via gh pr view 85025 --json files

    Root Cause

    The logic for determining the "Pay" action badge in getIOUReportActionWithBadge:

    // Line 9805 in src/libs/actions/IOU/index.ts
    if (canIOUBePaid(iouReport, chatReport, policy, undefined, undefined, undefined, undefined, invoiceReceiverPolicy)) {
        actionBadge = CONST.REPORT.ACTION_BADGE.PAY;
        return true;
    }

    However, canIOUBePaid has special handling for negative amounts that requires onlyShowPayElsewhere=true:

    // Lines 9734 and 9744 in canIOUBePaid function
    const canShowMarkedAsPaidForNegativeAmount = onlyShowPayElsewhere && reimbursableSpend < 0;
    // ...
    return (
        isPayer &&
        isReportFinished &&
        !iouSettled &&
        (reimbursableSpend > 0 || canShowMarkedAsPaidForNegativeAmount) &&
        // ... other conditions
    );

    When onlyShowPayElsewhere=false (the default used in the badge logic), the function returns false for negative amounts, so no "Pay" badge is shown even though the expense preview shows "Mark as paid" button.

    The expense preview component correctly handles this case:

    // src/components/ReportActionItem/MoneyRequestReportPreview/MoneyRequestReportPreviewContent.tsx:215
    const onlyShowPayElsewhere = useMemo(() => !canIOUBePaid && getCanIOUBePaid(true), [canIOUBePaid, getCanIOUBePaid]);

    But the LHN badge logic does not check for onlyShowPayElsewhere.

  6. MelvinBot commented on Mar 13, 2026

    @MelvinBot
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When a negative amount expense is created, submitted, and approved, the expense preview correctly shows a "Mark as paid" action, but the LHN (Left Hand Navigation) does not display the corresponding "Pay" action badge. The badge should be visible to match the available action.

    What is the root cause of that problem?

    The root cause is a parameter asymmetry in how canIOUBePaid is called from the LHN badge path vs. the expense preview.

    canIOUBePaid (src/libs/actions/IOU/index.ts:9734) has a special guard for negative amounts:

    canShowMarkedAsPaidForNegativeAmount = onlyShowPayElsewhere && reimbursableSpend < 0
    

    This guard only activates when onlyShowPayElsewhere is true. For negative expenses, reimbursableSpend is negative (because expense report totals are stored inverted in the DB and then negated back in getMoneyRequestSpendBreakdown at src/libs/ReportUtils.ts:4412), so the standard reimbursableSpend > 0 check fails.

    The expense preview (MoneyReportHeader / MoneyRequestReportPreviewContent) works correctly because it calls canIOUBePaid twice — first with onlyShowPayElsewhere=false, and if that fails, again with onlyShowPayElsewhere=true. The second call enables canShowMarkedAsPaidForNegativeAmount, so "Mark as paid" appears.

    The LHN badge path (getIOUReportActionWithBadge at src/libs/actions/IOU/index.ts:9805) calls canIOUBePaid only once with onlyShowPayElsewhere left as undefined (defaults to false). So for negative amounts, canShowMarkedAsPaidForNegativeAmount is false, the reimbursableSpend > 0 check also fails, and no PAY badge is assigned.

    What changes do you think we should make in order to solve the problem?

    In getIOUReportActionWithBadge (src/libs/actions/IOU/index.ts:9805), mirror the two-step pattern used by MoneyReportHeader: if canIOUBePaid returns false with default parameters, try again with onlyShowPayElsewhere = true. If the second call succeeds, still assign ACTION_BADGE.PAY.

    What alternative solutions did you explore? (Optional)

    An alternative would be to modify canIOUBePaid itself to remove the onlyShowPayElsewhere requirement for negative amounts entirely. However, the onlyShowPayElsewhere parameter appears intentional — it distinguishes between showing a full "Pay" button vs. a "Mark as paid" / "Pay elsewhere" button. The two-step pattern in the badge path is more consistent with the existing approach in MoneyReportHeader and MoneyRequestReportPreviewContent.


    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.

  7. 47 remaining items

  8. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Apr 18, 2026
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Apr 18, 2026
  10. melvin-bot commented on Apr 18, 2026

    @melvin-bot

    Current assignees @Pujan92 and @aimane-chnaif are eligible for the External assigner, not assigning anyone new.

  11. changed the title [-][Due for payment 2026-04-17] LHN - Negative expenses show "Mark as paid" action but "Pay" badge is not visible on LHN.[/-] [+][$250] [Due for payment 2026-04-17] LHN - Negative expenses show "Mark as paid" action but "Pay" badge is not visible on LHN.[/+] on Apr 18, 2026
  12. melvin-bot commented on Apr 18, 2026

    @melvin-bot
  13. removed
    Help WantedApply this label when an issue is open to proposals by contributors
    on Apr 18, 2026
  14. mallenexpensify commented on Apr 18, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @aimane-chnaif paid $250 via Upwork
    Contributor+: @Pujan92 due $250 via NewDot

    @aimane-chnaif can you please accept the job below? Please reply here and tag me once you have.
    https://www.upwork.com/jobs/~022045485815877973993

    ^ Test case created

  15. melvin-bot commented on Apr 19, 2026

    @melvin-bot

    📣 @Daddaabdelghafour! 📣
    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:

    1. Make sure you've read and understood the contributing guidelines.
    2. 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.
    3. 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.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  16. Daddaabdelghafour commented on Apr 19, 2026

    @Daddaabdelghafour

    Proposal for Issue #85187 — LHN: Negative expenses show "Mark as paid" action but "Pay" badge is not visible**

    Root Cause Analysis

    The issue is a conditional rendering mismatch between two separate logic paths:

    1. The "Mark as paid" action is correctly triggered for negative expenses
    2. The "Pay" badge in the LHN has an additional guard condition that likely checks amount > 0 (or similar), which incorrectly excludes negative expense amounts

    These two conditions should be in sync — if the action is shown, the badge must be shown too.

    Fix Approach

    1. Locate the LHN badge rendering logic — likely in SidebarUtils.ts or the relevant report/transaction selector that determines badge visibility
    2. Find the condition controlling the "Pay" badge display and compare it against the condition showing the "Mark as paid" action
    3. Remove or adjust the amount guard so negative expenses are treated consistently across both the action and the badge
    4. Ensure no regression for positive expense flows — the fix should be scoped to the mismatch only

    Testing Plan**

    • Verify "Pay" badge appears on LHN for negative expenses after fix
    • Confirm "Mark as paid" action still works correctly
    • Test on iOS, Android, and web with screenshots before submitting PR
    • Confirm no regression for standard positive expense flows

    Contributor details

    Expensify account email: abroud498@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/abdelghafourd2

  17. mallenexpensify commented on Apr 20, 2026

    @mallenexpensify
    Contributor

    @Daddaabdelghafour please familiarize yourself with CONTRIBUTING.md before posting or risked being removed. Thx

  18. aimane-chnaif commented on Apr 20, 2026

    @aimane-chnaif
    Contributor

    @mallenexpensify accepted offer

  19. mallenexpensify commented on Apr 21, 2026

    @mallenexpensify
    Contributor

    @aimane-chnaif paid, summary updated above. Thx.

  20. twisterdotcom commented on Apr 24, 2026

    @twisterdotcom
    Contributor

    $250 approved for @Pujan92 in Report ID: R0001xroe4rH.

    Zapier Logs Run ID: 00040eee-eb44-a838-1564-d47fd29c2304

    SO: https://stackoverflowteams.com/c/expensify/questions/7582

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions