Skip to content

[Due for payment 2026-08-21] Expense - Workspace name is not displayed in system message when moving a report #98108

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: v9.4.51-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://github.com/Expensify/Expensify/issues/644121
Email or phone of affected tester (no customers): -
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: Windows 10 - Chrome

Action Performed:

  1. Log in with an account whose default currency is set to USD (User A).
  2. Go to the Inbox tab, click the FAB, and select Create Expense.
  3. Create a manual expense for an email address that does not yet have an Expensify account (Important step)
  4. In another browser, log in using the email address from step 3 (User B).
  5. For User B, set default currency to USD.
  6. As User B, navigate to the DM chat with User A and open the expense report.
  7. Click Pay and select Pay with business account.
  8. Cancel the bank account setup flow. Verify that the expense is moved to User B's workspace.
  9. As User A, navigate to the DM chat with User B (important: User A should not open the workspace chat).

Expected Result:

User A can see the following system message: moved this report to the [Workspace Name] workspace

Actual Result:

Workspace name is not visible in the system message. It appears after creating another expense in the chat

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7210575_1784279509262.bandicam_2026-07-17_11-58-18-501.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 9, 2026
  2. MelvinBot commented on Aug 9, 2026

    @MelvinBot
    Contributor

    Proposal

    Updated 2026-08-10 per feedback from nyomanjyotisa: recommended fix now uses the stored action message as the fallback, covers both consumption paths, and scopes CHANGE_POLICY out.

    What is the root cause of that problem?

    The workspace name in the "moved this report to the … workspace" system message is not read from the action — it is recomputed on every render from the current user's local Onyx policy collection, with a bare empty-string fallback:

    const toPolicyName = allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${toPolicyID}`]?.name ?? '';
    

    (ReportUtils.ts:7269-7281)

    User A is not a member of User B's workspace and never opened it, so policy_<toPolicyID> isn't in their Onyx. The lookup returns '' and the message renders with a blank name. It only appears later because creating another expense delivers that policy into User A's COLLECTION.POLICY via onyxData, after which the message re-renders correctly.

    Evidence & data flow

    Flow: User B pays with a business account → backend moves report + creates the MOVED action → User A receives the action but not the destination policy → name resolves to '' → blank. A later expense delivers the policy → name appears.

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

    Make getMovedActionMessage fall back to the server-rendered action message when the destination policy isn't available locally, instead of building the sentence with an empty name.

    In getMovedActionMessage: when allPolicies[policy_<toPolicyID>] is missing (so toPolicyName would be empty), return the action's stored HTML via getReportActionHtml(action) (ReportActionsUtils.ts:2123) rather than the freshly-built string. The broadcast action already carries the name the server rendered, so User A shows it immediately; when the policy is present locally, keep the current live-computed string so nothing else changes. This mirrors the existing pattern in the repo where messages fall back to getReportActionText(action) when their computed inputs aren't available (ReportActionsUtils.ts:2985, :2991).

    Both consumption paths are covered by returning the stored HTML — getMovedActionMessage's output is used two ways:

    Returning the stored html serves both (the text callers run it through htmlToText), and it inherently covers both shouldHideMovedReportUrl branches of the template since the stored HTML is whatever the server already produced.

    Out of scope: getPolicyChangeMessage (ReportUtils.ts:7283-7290) has the same live-lookup pattern for CHANGE_POLICY, but per this issue's scope it is not being changed here.

    ⚠️ One dependency to confirm during implementation: this fallback works only if the MOVED action broadcast to non-member User A actually contains the rendered name in its stored message HTML. If the backend sends non-members an action with no name in the message, the fallback would still be blank and the durable fix would be backend (include the name in the action payload). Worth verifying against a real payload before/while implementing.

    What alternative solutions did you explore? (Optional)

    Falling back to report?.policyName won't help — the report the action is shown in is the A↔B DM, not the workspace, so it has no workspace name for User A.

    Related issues

    Same area (system-message rendering) but distinct: #97328, #96687.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/98108) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Aug 9, 2026
  4. melvin-bot commented on Aug 9, 2026

    @melvin-bot

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

  5. melvin-bot commented on Aug 9, 2026

    @melvin-bot
  6. nyomanjyotisa commented on Aug 10, 2026

    @nyomanjyotisa
    Member

    @MelvinBot I verified that the MOVED action already stores the workspace name in message[0].html/text. Please use it when the destination policy is unavailable, cover both paths, and keep CHANGE_POLICY out of scope.

  7. MelvinBot commented on Aug 10, 2026

    @MelvinBot
    Contributor

    🤖 Draft PR created: #98112

    What it does: getMovedActionMessage (src/libs/ReportUtils.ts:7279) resolved the workspace name only from the local Onyx POLICY collection, so it rendered blank for participants who aren't members of the destination workspace. It now falls back to the workspace name already stored in the action's message (html, then text) when the policy isn't in Onyx. CHANGE_POLICY was left out of scope per your request.

    Checks run locally (all passed): oxfmt, ESLint (0 errors), typecheck-tsgo, and ReportUtilsTest.ts (1182 tests). I didn't run a live app repro because it needs a two-user business-account pay flow that a single signed-in session can't reproduce.

    Please add manual Tests/QA steps and mark it as "Ready for review" when it's ready.

  8. nyomanjyotisa commented on Aug 10, 2026

    @nyomanjyotisa
    Member

    @MelvinBot Please update your proposal to use the stored action message when the destination policy is unavailable, cover both paths, and keep CHANGE_POLICY out of scope. Please do not implement it yet.

  9. nyomanjyotisa commented on Aug 10, 2026

    @nyomanjyotisa
    Member

    MelvinBot’s updated proposal LGTM.

    🎀👀🎀 C+ reviewed

  10. melvin-bot commented on Aug 10, 2026

    @melvin-bot

    Triggered auto assignment to @aldo-expensify, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

  11. aldo-expensify commented on Aug 10, 2026

    @aldo-expensify
    Contributor

    The proposal looks good to me 👍

  12. 11 remaining items

  13. nyomanjyotisa commented on Aug 17, 2026

    @nyomanjyotisa
    Member

    BugZero Checklist:

  14. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Aug 17, 2026
  15. melvin-bot commented on Aug 20, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  16. melvin-bot commented on Aug 20, 2026

    @melvin-bot

    Payment Summary

    Resolving PRs:

    BugZero Checklist (@mallenexpensify)

    • I have confirmed assignees, roles, and Upwork contracts look correct
    • I have paid out Upwork contracts / manual NewDot requests
    • [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon
  17. mallenexpensify commented on Aug 21, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @nyomanjyotisa due $250 via NewDot

  18. trjExpensify commented on Aug 24, 2026

    @trjExpensify
    Contributor

    approved $250 for @nyomanjyotisa

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