Skip to content

Expense - Change workspace option is shown for sender in IOU report #71740

Closed

Description

@jponikarchuk

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.22-1
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from TestRail: #66933
Email or phone of affected tester (no customers): jnodijsdonijsojsd@gmail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.5 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • User has a workspace.
  1. Go to staging.new.expensify.com
  2. Open FAB > Create expense > Manual.
  3. Submit a manual expense to any user who is not a member of the workspace.
  4. Open the expense report.
  5. Click More > Change workspace.
  6. Select the workspace.

Expected Result:

Change workspace option should not be shown for the sender in IOU report (production behavior).

Actual Result:

Change workspace option is shown for sender in IOU report.
After moving the IOU to workspace, the recipient is not a member of the workspace. The IOU is moved to admin's workspace chat. So the recipient cannot do anything about the expense.

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

11.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @luacmartins

Activity

  1. added
    DeployBlockerCash
    Bug
    on Oct 2, 2025
  2. melvin-bot commented on Oct 2, 2025

    @melvin-bot

    Triggered auto assignment to @flaviadefaria (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. melvin-bot commented on Oct 2, 2025

    @melvin-bot

    Triggered auto assignment to @Beamanator (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  4. melvin-bot commented on Oct 2, 2025

    @melvin-bot

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

  5. github-actions commented on Oct 2, 2025

    @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.
  6. samranahm commented on Oct 2, 2025

    @samranahm
    Contributor

    Proposal

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

    Expense - Change workspace option is shown for sender in IOU report

    What is the root cause of that problem?

    function isChangeWorkspaceAction(report: Report, policies: OnyxCollection<Policy>, reportActions?: ReportAction[]): boolean {
    const availablePolicies = Object.values(policies ?? {}).filter((newPolicy) => isWorkspaceEligibleForReportChange(newPolicy, report, policies));
    let hasAvailablePolicies = availablePolicies.length > 1;
    if (!hasAvailablePolicies && availablePolicies.length === 1) {
    hasAvailablePolicies = !report.policyID || report.policyID !== availablePolicies?.at(0)?.id;
    }
    const reportPolicy = policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`];
    return hasAvailablePolicies && canEditReportPolicy(report, reportPolicy) && !isExportedUtils(reportActions);
    }

    There is currently no logic to check the report sender here

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

    function isChangeWorkspaceAction(report: Report, policies: OnyxCollection<Policy>, reportActions?: ReportAction[]): boolean {
    const availablePolicies = Object.values(policies ?? {}).filter((newPolicy) => isWorkspaceEligibleForReportChange(newPolicy, report, policies));
    let hasAvailablePolicies = availablePolicies.length > 1;
    if (!hasAvailablePolicies && availablePolicies.length === 1) {
    hasAvailablePolicies = !report.policyID || report.policyID !== availablePolicies?.at(0)?.id;
    }
    const reportPolicy = policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`];
    return hasAvailablePolicies && canEditReportPolicy(report, reportPolicy) && !isExportedUtils(reportActions);
    }

    We should explicitly check the report sender and return false here

      const isReportSubmitter = isCurrentUserSubmitter(report);
      if (isReportSubmitter) {
          return false;
      }

    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.

  7. Burhan-Rashid commented on Oct 2, 2025

    @Burhan-Rashid
    Contributor

    This blocker is caused by this PR: #66933
    Should we revert this PR @Beamanator @flaviadefaria
    I am quite new here and i don't know exactly if we need to fix this or revert this?

  8. added
    Reviewing
    on Oct 2, 2025
  9. 29 remaining items

  10. jponikarchuk commented on Oct 16, 2025

    @jponikarchuk
    Author

    @heyjennahay The issue is still reproducible. The initial recipient can see the expense but cannot do anything about it after moving to the workspace

    screen_recording_2025-10-16_at_12.39.23.mp4
  11. melvin-bot commented on Oct 16, 2025

    @melvin-bot

    @Beamanator @heyjennahay @Burhan-Rashid @ishpaul777 @jponikarchuk this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

  12. Burhan-Rashid commented on Oct 16, 2025

    @Burhan-Rashid
    Contributor

    @luacmartins Any suggestion here. Is this the expected behaviour?

  13. luacmartins commented on Oct 16, 2025

    @luacmartins
    Contributor

    Hmm the old recipient shouldn't see the expense anymore. It might be a BE bug. I can take a look at it.

  14. self-assigned this
    on Oct 16, 2025
  15. melvin-bot commented on Oct 20, 2025

    @melvin-bot

    @jponikarchuk Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  16. luacmartins commented on Oct 20, 2025

    @luacmartins
    Contributor

    I'll look into it this week

  17. luacmartins commented on Oct 27, 2025

    @luacmartins
    Contributor

    I'm looking at the OP again, and this is expected:

    Change workspace option is shown for sender in IOU report.
    After moving the IOU to workspace, the recipient is not a member of the workspace. The IOU is moved to admin's workspace chat. So the recipient cannot do anything about the expense.

    We changed the permissions to allow users to change the workspace of an IOU. Right now, the submitter can always change reports to any workspace they are a member of. In that case, a few things happen:

    1. The report is converted from IOU to Expense
    2. The report is put back in OPEN state
    3. The report is unshared with the previous approver/payer
    4. The report is shared with the new approver on the workspace

    So this is not an issue. We can close this.

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

Metadata

Metadata

Labels

BugDailyEngineering

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions