Skip to content

[Due for payment 2025-02-13] [$250] Expense -Categorized track expense can´t be deleted from report but can be deleted on search #54036

Closed

Description

@lanitochka17

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.0.75-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): ibellicotest+91@gmail.com
Issue reported by: Applause - Internal Team
Component Money Requests

Action Performed:

  1. Open the staging.new.expensify.com website
  2. Open self DM
  3. Tap on "+" button and select "Track Expense"
  4. Complete the creation flow
  5. Once navigated to chat, tap on "Categorize it"
  6. Select any category
  7. Add a merchant
  8. Submit the expense to any workspace
  9. Once navigated to workspace chat, long tap on the submitted expense and search for the "Delete Expense" option
  10. Open the expense report
  11. Tap on the header and look for the "Delete Expense" option
  12. Go to search section
  13. Long tap over the expense and delete it

Expected Result:

The user should be able to delete the tracked expense from context menu on chat, from report header or from search section

Actual Result:

"Delete Expense" option is not displayed on context menu or on report header after submitting a categorized track expense, but the expense can be deleted from search section

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6692275_1734013745016.No_Delete.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021867523445838450965
  • Upwork Job ID: 1867523445838450965
  • Last Price Increase: 2025-01-27
  • Automatic offers:
    • FitseTLT | Contributor | 105912691
Issue OwnerCurrent Issue Owner: @sonialiap

Activity

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

    @melvin-bot

    Triggered auto assignment to @sonialiap (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. Tony-MK commented on Dec 13, 2024

    @Tony-MK
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-12-20 12:01:06 UTC.

    Proposal

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

    Expense -Categorized track expense can´t be deleted from report but can be deleted on search

    What is the root cause of that problem?

    The canAddOrDeleteTransactions function returns false early because the policy has autoReporting set to instant and approvalMode set to optional and it doesn't expect hasOnlyNonReimbursableTransactions to return false a for moneyRequestReport like this.

    App/src/libs/ReportUtils.ts

    Lines 1825 to 1828 in e27c5ea

    const policy = getPolicy(moneyRequestReport?.policyID);
    if (PolicyUtils.isInstantSubmitEnabled(policy) && PolicyUtils.isSubmitAndClose(policy) && hasOnlyNonReimbursableTransactions(moneyRequestReport?.reportID)) {
    return false;
    }

    This is because transaction?.reimbursable was initially set as false and has not been adjusted by either the FE or BE.

    Screenshot 2024-12-20 at 13 34 33

    Screenshot 2024-12-20 at 15 12 09

    /**
    * Return the reimbursable value. Defaults to true to match BE logic.
    */
    function getReimbursable(transaction: Transaction): boolean {
    return transaction?.reimbursable ?? true;
    }

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

    We should either merge reimbursable as true or delete the reimbursable attribute from the original transaction and its draft whichever is more reasonable for the transaction.

    In getDeleteTrackExpenseInformation, let's extend the shouldDeleteTransactionFromOnyx if statement with an else if statement checking if isMovingTransactionFromTrackExpense is true like the snippet below.

    if (shouldDeleteTransactionFromOnyx){
        ....
    } else if (isMovingTransactionFromTrackExpense) {
        optimisticData.push({
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
            value: {reimbursable: true}, // OR {reimbursable: null}
        });
    
        optimisticData.push({
            onyxMethod: Onyx.METHOD.MERGE,
            key: `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`,
            value: {reimbursable: true}, // OR {reimbursable: null}
        });
    }

    This will fix the bug while the user is offline but we have to fix the backend to do the same to prevent it from occurring while online.

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    and removed
    BugSomething is broken. Auto assigns a BugZero manager.
    on Dec 13, 2024
  5. melvin-bot commented on Dec 13, 2024

    @melvin-bot
  6. changed the title [-]Expense -Categorized track expense can´t be deleted from report but can be deleted on search[/-] [+][$250] Expense -Categorized track expense can´t be deleted from report but can be deleted on search[/+] on Dec 13, 2024
  7. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Dec 13, 2024
  8. added
    BugSomething is broken. Auto assigns a BugZero manager.
    and removed
    Help WantedApply this label when an issue is open to proposals by contributors
    on Dec 13, 2024
  9. melvin-bot commented on Dec 13, 2024

    @melvin-bot

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

  10. melvin-bot commented on Dec 13, 2024

    @melvin-bot

    Current assignee @sonialiap is eligible for the Bug assigner, not assigning anyone new.

  11. 80 remaining items

  12. changed the title [-][$250] Expense -Categorized track expense can´t be deleted from report but can be deleted on search[/-] [+][Due for payment 2025-02-13] [$250] Expense -Categorized track expense can´t be deleted from report but can be deleted on search[/+] on Feb 6, 2025
  13. melvin-bot commented on Feb 6, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  14. melvin-bot commented on Feb 6, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.94-25 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2025-02-13. 🎊

    For reference, here are some details about the assignees on this issue:

  15. melvin-bot commented on Feb 6, 2025

    @melvin-bot

    @jayeshmangwani @sonialiap @jayeshmangwani The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  16. jayeshmangwani commented on Feb 13, 2025

    @jayeshmangwani
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: I don't think this is the result of any PR; it’s just that this case wasn’t considered when categorizing the self-DM expense.

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: N/A

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • Regression test https://github.com/Expensify/Expensify/issues/469982

    Regression Test Proposal

    1. Create a new workspace.
    2. Go to Workflows and toggle off the "Add approvals" option.
    3. Open self DM.
    4. Tap on the "+" button and select "Create Expense."
    5. Complete the expense creation flow.
    6. Once navigated to chat, tap on "Categorize it."
    7. Select the workspace you created in step (1).
    8. Add a merchant.
    9. Submit the expense.
    10. Go to the expense detail view and tap on the header.
    11. Verify that the "Delete Expense" option is present.
    12. Press the "Delete Expense" option and confirm that the expense is deleted without any errors.

    Do we agree 👍 or 👎

  17. sonialiap commented on Feb 13, 2025

    @sonialiap
    Contributor

    Payment summary:

  18. moved this from Bugs and Follow Up Issues to Done in #expensify-bugson Feb 13, 2025
  19. garrettmknight commented on Feb 28, 2025

    @garrettmknight
    Contributor

    $250 approved for @jayeshmangwani

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