Skip to content

[Due for payment 2025-09-22] [$250] Expense - "Moved this expense to personal space" shown on expense moved to report on same WS #68628

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.1.95-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: https://test-management.browserstack.com/projects/2219752/test-runs/TR-286/folder/13176670/41237099/842122512
Email or phone of affected tester (no customers): ibellicotest+1606@gmail.com
Issue reported by: Applause Internal Team
Device used: Motorola MotoG60 / Android 12 / Chrome ( mWeb / Hybrid app) - Windows 10 / Chrome
App Component: Money Requests

Action Performed:

Prerequisite: Account has at least one workspace available.
Prerequisite 2: Account has a Self DM.

  1. Open the staging.new.expensify.com website.
  2. Open any workspace chat.
  3. Create a manual expense.
  4. Create a new report on the same workspace chat, but don´t submit any expense to it.
  5. Open the expense created on step 3.
  6. Tap on the report field and select the report created on step 4.
  7. Once expense is moved and you land on the empty report, tap on "More" and delete the report.
  8. Open the report where the expense was moved.
  9. Note that a "Moved this expense to your personal space" system message is displayed.

Expected Result:

When an expense is moved to a different report on the same workspace, the system message generated with this action, should be "Moved this expense to Expense Report XX".

Actual Result:

When an expense is moved to a different report on the same workspace, and the first report is deleted, the correct "Moved this expense to Expense Report XX" appears, but also a "Moved this expense to your personal space" message can be seen on the moved 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

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021959570938508196807
  • Upwork Job ID: 1959570938508196807
  • Last Price Increase: 2025-08-31
Issue OwnerCurrent Issue Owner: @muttmuure

Activity

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

    @melvin-bot

    Triggered auto assignment to @muttmuure (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. aadil42 commented on Aug 17, 2025

    @aadil42
    Contributor

    Proposal

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

    When we create a manual expense in a workspace and then we move that expense to a report in the same workspace there are two msgs that are shown.

    "moved this expense to {exepnseReportName}" (expected)
    "moved this expense to your to your personal space" (not expected)

    Image

    What is the root cause of that problem?

    Here we are filtering out all the reportActions that should not be visible.

    shouldReportActionBeVisible(reportAction, reportAction.reportActionID, canPerformWriteAction) &&
    isIOUActionMatchingTransactionList(reportAction, reportTransactionIDs),

    in the shouldReportActionBeVisible function we're not taking care of the case where an unreported expense is moved to a report.

    function shouldReportActionBeVisible(reportAction: OnyxEntry<ReportAction>, key: string | number, canUserPerformWriteAction?: boolean): boolean {
    if (!reportAction) {
    return false;
    }
    if (isReportActionDeprecated(reportAction, key)) {
    return false;
    }
    // Filter out any unsupported reportAction types
    if (!supportedActionTypes.includes(reportAction.actionName)) {
    return false;
    }
    // Ignore closed action here since we're already displaying a footer that explains why the report was closed
    if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CLOSED && !isMarkAsClosedAction(reportAction)) {
    return false;
    }
    // Ignore markedAsReimbursed action here since we're already display message that explains the expense was paid
    // elsewhere in the IOU reportAction
    if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.MARKED_REIMBURSED) {
    return false;
    }
    if (isWhisperActionTargetedToOthers(reportAction)) {
    return false;
    }
    if (isPendingRemove(reportAction) && !reportAction.childVisibleActionCount) {
    return false;
    }
    if (
    (isActionableReportMentionWhisper(reportAction) || isActionableJoinRequestPendingReportAction(reportAction) || isActionableMentionWhisper(reportAction)) &&
    !canUserPerformWriteAction
    ) {
    return false;
    }
    if (isTripPreview(reportAction) || isTravelUpdate(reportAction)) {
    return true;
    }
    // If action is actionable whisper and resolved by user, then we don't want to render anything
    if (isActionableWhisper(reportAction) && isResolvedActionableWhisper(reportAction)) {
    return false;
    }
    if (!isVisiblePreviewOrMoneyRequest(reportAction)) {
    return false;
    }
    // All other actions are displayed except thread parents, deleted, or non-pending actions
    const isDeleted = isDeletedAction(reportAction);
    const isPending = !!reportAction.pendingAction;
    return !isDeleted || isPending || isDeletedParentAction(reportAction) || isReversedTransaction(reportAction);
    }

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

    We should take care of the case where an expense was unreported and then moved to a report so we can filter out the reportAction that displays the msg "moved this expense to your personal space"

    ReportActionsUtils.ts -> shouldReportActionBeVisible function

    // add this condition.
     if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.UNREPORTED_TRANSACTION && !isMovedTransactionAction(reportAction)) {
            return false;
        }

    Like we're doing here for closed action.

    if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CLOSED && !isMarkAsClosedAction(reportAction)) {
    return false;
    }

    And also doing for reimbursed actions

    if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.MARKED_REIMBURSED) {
    return false;
    }

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore? (Optional)

  4. aadil42 commented on Aug 17, 2025

    @aadil42
    Contributor
    Screen.Recording.2025-08-17.at.2.mp4
  5. D-01576 commented on Aug 17, 2025

    @D-01576

    Proposal

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

    When an expense is moved from one workspace report to another, and the original report is deleted, the system currently displays two messages:

    • The correct message: "Moved this expense to Expense Report XX"
    • An incorrect message: "Moved this expense to your personal space"

    This is confusing for users, as the expense was not moved to personal space, but to another workspace report.

    What is the root cause of that problem?

    The code previously always added an UNREPORTED_TRANSACTION system message in src/libs/actions/Report.ts when deleting a report, regardless of whether the expense was being moved to another workspace report or to personal space. This was due to the lack of a conditional check on the destination of the moved expense, resulting in both messages being shown.

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

    Update the logic in src/libs/actions/Report.ts so that the UNREPORTED_TRANSACTION system message is only added if the expense is actually being moved to personal space (unreported). This is done by checking if the target report is a personal space before adding the action. If the expense is moved to another workspace report, only the correct message ("Moved this expense to Expense Report XX") will be shown.

    before adding condition:

        const unreportedAction = buildOptimisticUnreportedTransactionAction(childReportID, reportID);
    
        optimisticData.push({
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${childReportID}`,
            value: {[unreportedAction.reportActionID]: unreportedAction},
        });
    
        successData.push({
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${childReportID}`,
            value: {[unreportedAction.reportActionID]: {pendingAction: null}},
        });
    
        failureData.push({
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${childReportID}`,
            value: {[unreportedAction.reportActionID]: null},
        });
    
        if (transactionID) {
            transactionIDToReportActionAndThreadData[transactionID] = {
                ...transactionIDToReportActionAndThreadData[transactionID],
                moneyRequestPreviewReportActionID: newReportActionID,
                movedReportActionID: unreportedAction?.reportActionID,
            };
        }

    After adding condition:

        const childReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${childReportID}`];
        const isMovingToPersonalSpace = !childReport?.policyID || childReport.policyID === CONST.POLICY.ID_FAKE;
        if (isMovingToPersonalSpace) {
            const unreportedAction = buildOptimisticUnreportedTransactionAction(childReportID, reportID);
    
            optimisticData.push({
                onyxMethod: Onyx.METHOD.MERGE,
                key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${childReportID}`,
                value: {[unreportedAction.reportActionID]: unreportedAction},
            });
    
            successData.push({
                onyxMethod: Onyx.METHOD.MERGE,
                key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${childReportID}`,
                value: {[unreportedAction.reportActionID]: {pendingAction: null}},
            });
    
            failureData.push({
                onyxMethod: Onyx.METHOD.MERGE,
                key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${childReportID}`,
                value: {[unreportedAction.reportActionID]: null},
            });
    
            if (transactionID) {
                transactionIDToReportActionAndThreadData[transactionID] = {
                    ...transactionIDToReportActionAndThreadData[transactionID],
                    moneyRequestPreviewReportActionID: newReportActionID,
                    movedReportActionID: unreportedAction?.reportActionID,
                };
            }
        }

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    none

    What alternative solutions did you explore? (Optional)

    none

  6. D-01576 commented on Aug 17, 2025

    @D-01576
    fixed.mov
  7. thelullabyy commented on Aug 18, 2025

    @thelullabyy
    Contributor

    Proposal

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

    • When an expense is moved to a different report within the same workspace, and the original report is then deleted, the correct system message — “Moved this expense to Expense Report XX” — appears. However, an additional incorrect message — “Moved this expense to your personal space” — is also displayed on the moved expense.

    What is the root cause of that problem?

    • During report deletion, the app adds a UNREPORTED_TRANSACTION for each IOU action in the report:

      // 4. Add UNREPORTED_TRANSACTION report action

      (IOU actions are gathered here:
      Object.values(reportActionsForReport ?? {}).forEach((reportAction) => {
      )

    • The root cause is that reportActionsForReport does not filter out actions that are marked as deleted. In this scenario, the IOU action corresponding to the moved transaction is already marked as deleted, but it is still included in the subsequent processing.

    • Consequently, a UNREPORTED_TRANSACTION is constructed for a deleted IOU action, which erroneously yields the “personal space” message.

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

    This ensures only valid, non-deleted IOU actions are considered, preventing the spurious “personal space” message.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    • NA

    What alternative solutions did you explore? (Optional)

  8. melvin-bot commented on Aug 20, 2025

    @melvin-bot

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

  9. melvin-bot commented on Aug 22, 2025

    @melvin-bot

    @muttmuure Huh... This is 4 days overdue. Who can take care of this?

  10. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Aug 24, 2025
  11. changed the title [-]Expense - "Moved this expense to personal space" shown on expense moved to report on same WS[/-] [+][$250] Expense - "Moved this expense to personal space" shown on expense moved to report on same WS[/+] on Aug 24, 2025
  12. melvin-bot commented on Aug 24, 2025

    @melvin-bot
  13. 44 remaining items

  14. muttmuure commented on Oct 6, 2025

    @muttmuure
    Contributor

    Payment Summary

    Contributor: @thelullabyy paid $250 via Upwork
    Contributor+: @Pujan92 due $250 via NewDot

  15. muttmuure commented on Oct 6, 2025

    @muttmuure
    Contributor

    @thelullabyy I think you've already been paid here: https://www.upwork.com/ab/feedbacks/c/1328455843768528896/contract/41051159

    Please let me know via Slack if otherwise

  16. thelullabyy commented on Oct 7, 2025

    @thelullabyy
    Contributor

    @thelullabyy I think you've already been paid here: https://www.upwork.com/ab/feedbacks/c/1328455843768528896/contract/41051159

    @muttmuure I’m curious why you mentioned that I’ve already been paid in #65413, as these are actually two separate issues.

  17. JmillsExpensify commented on Oct 8, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @Pujan92

  18. thelullabyy commented on Oct 8, 2025

    @thelullabyy
    Contributor

    @JmillsExpensify Friendly reminder to take a look at my thought #68628 (comment)

  19. muttmuure commented on Oct 22, 2025

    @muttmuure
    Contributor
  20. thelullabyy commented on Oct 22, 2025

    @thelullabyy
    Contributor

    @muttmuure Thanks. I applied to the job.

  21. madmax330 commented on Oct 27, 2025

    @madmax330
    Contributor

    Not overdue

  22. melvin-bot commented on Oct 27, 2025

    @melvin-bot

    @muttmuure Eep! 4 days overdue now. Issues have feelings too...

  23. muttmuure commented on Oct 28, 2025

    @muttmuure
    Contributor

    Paid

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

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions