Skip to content

[Due for payment 2025-03-25] [$125] Expense - Unexpexted error when trying to delete an expense. #57971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
4 of 8 tasks
mitarachim opened this issue Mar 7, 2025 · 31 comments
Closed
4 of 8 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@mitarachim
Copy link

mitarachim commented Mar 7, 2025

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.1.10-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes, reproducible on both
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): [email protected]
Issue reported by: Applause Internal Team
Device used: Motorola MotoG60 - Android 12 - Chrome / Windows 10 - Chrome
App Component: Money Requests

Action Performed:

Prerequisite: Delayed submissions and approvals enabled.

  1. Open the Expensify app.
  2. Open a workspace chat.
  3. Tap on the "+" button and select "Create Expense"
  4. Complete the creation flow.
  5. Once redirected to chat, tap on "Submit" and "Approve" on the expense preview.
  6. Long tap on the expense preview.
  7. Tap on "Delete Comment"
  8. Check the expense behaviour after this action.

Expected Result:

User should be able to delete the expense without any issue after submitting it.

Actual Result:

"Unexpected error" message is displayed when user tries to delete an expense via context menu, after submitting it and approving it. Also, "Delete Comment" is displayed on context menu instead of "Delete Expense"

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6763495_1741310149437.Unexpected.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021897868050174930335
  • Upwork Job ID: 1897868050174930335
  • Last Price Increase: 2025-03-18
Issue OwnerCurrent Issue Owner: @garrettmknight
@mitarachim mitarachim added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 DeployBlocker Indicates it should block deploying the API DeployBlockerCash This issue or pull request should block deployment labels Mar 7, 2025
Copy link

melvin-bot bot commented Mar 7, 2025

Triggered auto assignment to @garrettmknight (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.

Copy link

melvin-bot bot commented Mar 7, 2025

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

Copy link

melvin-bot bot commented Mar 7, 2025

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

Copy link
Contributor

github-actions bot commented Mar 7, 2025

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

@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Mar 7, 2025
@robertjchen robertjchen removed DeployBlockerCash This issue or pull request should block deployment DeployBlocker Indicates it should block deploying the API labels Mar 7, 2025
@robertjchen
Copy link
Contributor

we were having site issues at the time, can we try testing again?

@mitarachim
Copy link
Author

Hello @robertjchen issue still reproducible

screen-20250307-001153.mp4

@bernhardoj
Copy link
Contributor

Proposal

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

Error when deleting expense.

What is the root cause of that problem?

When we already approved the expense, the delete option shouldn't be shown.

App/src/libs/ReportUtils.ts

Lines 2115 to 2117 in fb79730

if (isReportApproved({report: moneyRequestReport}) || isClosedReport(moneyRequestReport) || isSettled(moneyRequestReport?.reportID)) {
return false;
}

However, the report passed is the policy expense chat, not the expense report. This started to happen after we allowed deleting a single transaction report preview. We pass the moneyRequestAction, which is the single IOU action but with the current report reportID, the policy expense chat reportID.

shouldShow: ({type, reportAction, isArchivedRoom, isChronosReport, reportID, moneyRequestAction}) =>
// Until deleting parent threads is supported in FE, we will prevent the user from deleting a thread parent
type === CONST.CONTEXT_MENU_TYPES.REPORT_ACTION &&
canDeleteReportAction(moneyRequestAction ?? reportAction, reportID) &&

Also, if we see the delete option, it reads "Delete comment" instead of "Delete expense". That's because we pass the report preview action instead of the IOU action to the translate key.

const text = textTranslateKey && (isKeyInActionUpdateKeys ? translate(textTranslateKey, {action: reportAction}) : translate(textTranslateKey));

deleteAction: ({action}: DeleteActionParams) => `Delete ${action?.actionName === CONST.REPORT.ACTIONS.TYPE.IOU ? 'expense' : 'comment'}`,

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

First, we need to pass the expense report reportID.

shouldShow: ({type, reportAction, isArchivedRoom, isChronosReport, reportID, moneyRequestAction}) =>
// Until deleting parent threads is supported in FE, we will prevent the user from deleting a thread parent
type === CONST.CONTEXT_MENU_TYPES.REPORT_ACTION &&
canDeleteReportAction(moneyRequestAction ?? reportAction, reportID) &&
!isArchivedRoom &&
!isChronosReport &&
!isMessageDeleted(reportAction),
onPress: (closePopover, {reportID, reportAction, moneyRequestAction}) => {
if (closePopover) {
// Hide popover, then call showDeleteConfirmModal
hideContextMenu(false, () => showDeleteModal(reportID, moneyRequestAction ?? reportAction));
return;
}
// No popover to hide, call showDeleteConfirmModal immediately
showDeleteModal(reportID, moneyRequestAction ?? reportAction);

We can get it from the original message.

getOriginalMessage(moneyRequestAction)?.IOUReportID ?? reportID

For the second issue, we need to pass the moneyRequestAction.

const text = textTranslateKey && (isKeyInActionUpdateKeys ? translate(textTranslateKey, {action: reportAction}) : translate(textTranslateKey));

action: moneyRequestAction ?? reportAction

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

N/A

@robertjchen robertjchen added Daily KSv2 External Added to denote the issue can be worked on by a contributor and removed Hourly KSv2 labels Mar 7, 2025
@melvin-bot melvin-bot bot changed the title Expense - Unexpexted error when trying to delete an expense. [$250] Expense - Unexpexted error when trying to delete an expense. Mar 7, 2025
Copy link

melvin-bot bot commented Mar 7, 2025

Job added to Upwork: https://www.upwork.com/jobs/~021897868050174930335

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 7, 2025
Copy link

melvin-bot bot commented Mar 7, 2025

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

@akinwale
Copy link
Contributor

akinwale commented Mar 8, 2025

@bernhardoj's proposal looks good here.

🎀👀🎀 C+ reviewed.

Copy link

melvin-bot bot commented Mar 8, 2025

Current assignee @robertjchen is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@robertjchen
Copy link
Contributor

Sounds good, thanks for the review 👍

@bernhardoj
Copy link
Contributor

PR is ready

cc: @akinwale

Copy link

melvin-bot bot commented Mar 17, 2025

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@garrettmknight garrettmknight changed the title [$250] Expense - Unexpexted error when trying to delete an expense. [$125] Expense - Unexpexted error when trying to delete an expense. Mar 18, 2025
Copy link

melvin-bot bot commented Mar 18, 2025

Upwork job price has been updated to $125

@garrettmknight
Copy link
Contributor

@akinwale can you have a look at this deploy blocker and see if this PR caused it?

@akinwale
Copy link
Contributor

@akinwale can you have a look at this deploy blocker and see if this PR caused it?

The link seems to be mixed up in your post, but yes, this deploy blocker was caused by the PR for this issue.

@garrettmknight
Copy link
Contributor

Thanks for confirming - do we need to do anything here to correct or is that other issue correcting entirely?

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Mar 18, 2025
@melvin-bot melvin-bot bot changed the title [$125] Expense - Unexpexted error when trying to delete an expense. [Due for payment 2025-03-25] [$125] Expense - Unexpexted error when trying to delete an expense. Mar 18, 2025
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 18, 2025
Copy link

melvin-bot bot commented Mar 18, 2025

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

Copy link

melvin-bot bot commented Mar 18, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.14-5 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-03-25. 🎊

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

  • @akinwale requires payment through NewDot Manual Requests
  • @bernhardoj requires payment through NewDot Manual Requests

Copy link

melvin-bot bot commented Mar 18, 2025

@akinwale @garrettmknight @akinwale 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]

@akinwale
Copy link
Contributor

Thanks for confirming - do we need to do anything here to correct or is that other issue correcting entirely?

There is a PR on the other issue which has been cherry-picked to the deploy, so nothing else to do here at this time except to complete the checklist.

@garrettmknight
Copy link
Contributor

Got it, we'll wait for the checklist and halve payment then. Thanks!

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Mar 25, 2025
Copy link

melvin-bot bot commented Mar 25, 2025

Payment Summary

Upwork Job

BugZero Checklist (@garrettmknight)

  • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1897868050174930335/hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@bernhardoj
Copy link
Contributor

Requested in ND.

@garrettmknight
Copy link
Contributor

@bernhardoj confirming you submitted $125 for the request due to the regression?

@melvin-bot melvin-bot bot removed the Overdue label Mar 25, 2025
@akinwale
Copy link
Contributor

@garrettmknight You'd also need to post a payment summary for the ND payments to be processed.

@JmillsExpensify
Copy link

$125 approved for @akinwale

@garrettmknight
Copy link
Contributor

Payment summary is here: #57971 (comment)

@bernhardoj
Copy link
Contributor

@garrettmknight yes

@JmillsExpensify
Copy link

$125 approved for @bernhardoj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

6 participants