Skip to content

[$250] LHN -When opening report created by admin, LHN shows report name instead of "Workspace owes" #77156

Closed

Description

@nlemma

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.2.74-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #75934
Email or phone of affected tester (no customers): ibellicotest+2180@gmail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Motorola MotoG60 / Android 12 / Chrome ( mWeb / Hybrid app) - Windows 11 / Chrome
App Component: Left Hand Navigation (LHN)

Action Performed:

Prerequisite: Have two accounts opened on two different devices or environments.
Prerequisite 2: User A has at least one workspace created.

  1. Open the staging.new.expensify.com website.
  2. Open any workspace chat.
  3. Tap the chat header and select Members.
  4. Invite User B as a member.
  5. Switch to User B's account.
  6. Open the same workspace chat.
  7. Switch back to User A's account.
  8. Create three manual expenses in the workspace chat.
  9. Switch again to User B's account.
  10. Verify that the LHN subtitle displays the "WorkspaceName- owes -amount-" as the last message in the workspace chat
  11. As User B, open expenses report.
  12. Note that the LHN subtitle of workspace chat, now displays the report´s title.
  13. Return to workspace chat.
  14. Note that the LHN subitlte of workspace chat, still shows the report´s title instead of "WorkspaceName- owes -amount"

Expected Result:

After member of workspace opens report of expenses created by admin, the workspace chat should still display "WorkspaceName- owes -amount" as subtitle on preview.

Actual Result:

After member of workspace opens report of expenses created by admin, the workspace chat preview on LHN changes to report´s title instead of showing "WorkspaceName- owes -amount" as subtitle.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7024924_1765287452302.LHN.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021998496943992918053
  • Upwork Job ID: 1998496943992918053
  • Last Price Increase: 2026-02-18
Issue OwnerCurrent Issue Owner: @robertjchen

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Dec 9, 2025
  2. melvin-bot commented on Dec 9, 2025

    @melvin-bot

    Triggered auto assignment to @isabelastisser (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. imadirtydog commented on Dec 9, 2025

    @imadirtydog

    Proposal

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

    LHN -When opening report created by admin, LHN shows report name instead of "Workspace owes

    What is the root cause of that problem?

    Here

    if (reportUtilsIsPolicyExpenseChat(report) && !isEmptyObject(iouReport)) {
    // eslint-disable-next-line @typescript-eslint/no-deprecated
    lastMessageTextFromReport = formatReportLastMessageText(getReportName(iouReport));

    The logic is explicitly set so that it uses report title for ws chats.

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

    It will be necessary to remove this code block

     if (reportUtilsIsPolicyExpenseChat(report) && !isEmptyObject(iouReport)) {
                // eslint-disable-next-line @typescript-eslint/no-deprecated
                lastMessageTextFromReport = formatReportLastMessageText(getReportName(iouReport));
            } 
    

    I.e. the code would look like this

      } else if (isReportPreviewAction(lastReportAction)) {
            const iouReport = getReportOrDraftReport(getIOUReportIDFromReportActionPreview(lastReportAction));
            const lastIOUMoneyReportAction = iouReport?.reportID
                ? allSortedReportActions[iouReport.reportID]?.find(
                      (reportAction, key): reportAction is ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.IOU> =>
                          shouldReportActionBeVisible(reportAction, key, canUserPerformWriteAction(report, isReportArchived)) &&
                          reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE &&
                          isMoneyRequestAction(reportAction),
                  )
                : undefined;
            const reportPreviewMessage = getReportPreviewMessage(
                !isEmptyObject(iouReport) ? iouReport : null,
                lastIOUMoneyReportAction ?? lastReportAction,
                true,
                reportUtilsIsChatReport(report),
                null,
                true,
                lastReportAction,
            );
            lastMessageTextFromReport = formatReportLastMessageText(P
    
    

    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.
    e

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    Help WantedApply this label when an issue is open to proposals by contributors
    on Dec 9, 2025
  5. changed the title [-]LHN -When opening report created by admin, LHN shows report name instead of "Workspace owes"[/-] [+][$250] LHN -When opening report created by admin, LHN shows report name instead of "Workspace owes"[/+] on Dec 9, 2025
  6. melvin-bot commented on Dec 9, 2025

    @melvin-bot
  7. melvin-bot commented on Dec 9, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @shubham1206agra (External)

  8. Nodebrute commented on Dec 9, 2025

    @Nodebrute
    Contributor

    Proposal

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

    When opening report created by admin, LHN shows report name instead of "Workspace owes"

    What is the root cause of that problem?

    Actually the correct expected behaviour is to show report title here even when the user has not opened the report yet. So the bug is that the LHN shoes worspace owes instead of report title. Can confirm this from this comment

    // For workspace chats, use the report title
    if (reportUtilsIsPolicyExpenseChat(report) && !isEmptyObject(iouReport)) {

    and also from the tests

    it('For policy expense chat whose last action is a report preview linked to an expense report with non-reimbursable transaction the LHN text should be the report name', async () => {

    Before opening the report iouReport is empty and falls back to getReportPreviewMessage that shows owes amount ❌
    After opening the report iouReport gets loaded and uses report name that shows report title ✅

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

    We can use lastReportAction?.childReportName to get the report name that is available immediately the same approach we also use in getReportPreviewMessage

    we can change this

    if (reportUtilsIsPolicyExpenseChat(report) && !isEmptyObject(iouReport)) {
    // eslint-disable-next-line @typescript-eslint/no-deprecated
    lastMessageTextFromReport = formatReportLastMessageText(getReportName(iouReport));
    } else {

       if (reportUtilsIsPolicyExpenseChat(report)) {
           
                const reportTitle = lastReportAction?.childReportName || (!isEmptyObject(iouReport) ? iouReport.reportName : undefined);
                if (reportTitle) {
                    lastMessageTextFromReport = formatReportLastMessageText(reportTitle);
                }
            }
    

    Note: This is just pseudocode. The overall concept will be the same and minor adjustments and lint fixes can be done in the pr.

    Optional: We can make iouReport.reportName priority

      const reportTitle = (!isEmptyObject(iouReport) ? iouReport.reportName : undefined) ?? lastReportAction?.childReportName;
    

    What alternative solutions did you explore? (Optional)

  9. lukeahill97 commented on Dec 10, 2025

    @lukeahill97

    Proposal

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

    When a workspace member opens an expense report created by the admin, the LHN subtitle for the workspace chat changes from "WorkspaceName owes amount" to the report's title. After returning to the workspace chat, the LHN subtitle continues to show the report title instead of reverting to "WorkspaceName owes amount".

    What is the root cause of that problem?

    The root cause is in src/libs/OptionsListUtils/index.ts around lines 660-663. The code has a special case that overrides the preview message for workspace chats:

    if (reportUtilsIsPolicyExpenseChat(report) && !isEmptyObject(iouReport)) {
        // eslint-disable-next-line @typescript-eslint/no-deprecated
        lastMessageTextFromReport = formatReportLastMessageText(getReportName(iouReport));
    }

    The issue is that this check depends on whether iouReport is loaded:

    Before opening the report:

    • iouReport is empty/not loaded
    • isEmptyObject(iouReport) returns true
    • The condition fails, so it uses getReportPreviewMessage() which shows "Workspace owes amount" ✓

    After opening the report:

    • The report is loaded into allReports
    • isEmptyObject(iouReport) returns false
    • The condition passes, overriding the preview message with getReportName(iouReport) ✗
    • This shows the report title instead of the "owes" message

    The problem is that the LHN display logic changes based on the report's load state rather than being consistent.

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

    Option 1: Always use the preview message for workspace chats with report previews

    Remove the special case override for workspace expense chats when the last action is a report preview. The getReportPreviewMessage function already handles workspace chats appropriately and returns consistent results regardless of load state.

    Modify the condition to exclude report preview actions:

    // Only use report name for workspace chats when NOT showing a report preview
    if (reportUtilsIsPolicyExpenseChat(report) && !isEmptyObject(iouReport) && !isReportPreviewAction(lastReportAction)) {
        // eslint-disable-next-line @typescript-eslint/no-deprecated
        lastMessageTextFromReport = formatReportLastMessageText(getReportName(iouReport));
    }

    This ensures:

    • When the last action is a report preview → always use getReportPreviewMessage() which shows "owes amount"
    • When the last action is NOT a report preview → use report name (for other workspace chat scenarios)
    • Behavior is consistent before/after opening the report

    Option 2: Check for actual money request count instead of just report existence

    Only show the report name when the report has actual transactions:

    if (reportUtilsIsPolicyExpenseChat(report) && !isEmptyObject(iouReport) && (iouReport.total !== 0 || iouReport.unheldTotal !== 0)) {
        // eslint-disable-next-line @typescript-eslint/no-deprecated
        lastMessageTextFromReport = formatReportLastMessageText(getReportName(iouReport));
    }

    This would prevent the override for expense reports that should show the "owes" preview message.

    Recommended: Option 1 - It's cleaner and ensures consistency by respecting the action type.

    What alternative solutions did you explore? (Optional)

    1. Remove the entire special case (as suggested by imadirtydog) - This might break other scenarios where workspace chats need to show the report name. We need to be more surgical.

    2. Always use childReportName (as suggested by Nodebrute) - Nodebrute makes an interesting argument that the expected behavior is reversed based on code comments and tests. However, this contradicts the issue description which treats "owes amount" as correct.

    3. Check if report was recently opened - Track whether the report was accessed and use that to determine display logic. This adds unnecessary state management.

    The proposed solution (Option 1) is cleanest because it makes the LHN display logic action-type aware rather than load-state dependent, ensuring consistent behavior.

  10. shubham1206agra commented on Dec 15, 2025

    @shubham1206agra
    Contributor

    This is internal as Pusher did not send the iouReport during creation of the report. If this is intentional, we can take a second look at proposals.

  11. 52 remaining items

  12. removed
    Help WantedApply this label when an issue is open to proposals by contributors
    on Feb 24, 2026
  13. Nodebrute commented on Mar 5, 2026

    @Nodebrute
    Contributor

    Will raise a pr today.

  14. robertjchen commented on Apr 9, 2026

    @robertjchen
    Contributor

    Just checking back in on this- was a PR created/merged on this?

  15. shubham1206agra commented on Apr 9, 2026

    @shubham1206agra
    Contributor

    @robertjchen I don't think so.

  16. IuliiaHerets commented on Apr 28, 2026

    @IuliiaHerets

    Issue is not reproducible anymore by QA team

    Not.mp4
  17. robertjchen commented on Apr 28, 2026

    @robertjchen
    Contributor

    thanks for the test, closing this out for now as it is no longer reproducible

  18. mallenexpensify commented on Apr 28, 2026

    @mallenexpensify
    Contributor

    Timeline....

    @Nodebrute not due payment
    @shubham1206agra is technically due 50%. Although, as the assigned lead on the issue and PR, I would have liked to see you push the contributor to bet the PR created. That's a responsibility of the C+. Please monitor issues/PRs more closely to ensure there's not a two month gap with nothing happening.

    Payment Summary

    Contributor+: @shubham1206agra due $125 via NewDot

  19. JmillsExpensify commented on May 1, 2026

    @JmillsExpensify
    Contributor

    $125 approved for @shubham1206agra

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorMonthlyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions