Skip to content
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

[HOLD for payment 2024-07-10] [$250] Track expense - "Delete expense" option appears for paid tracked expense #43591

Closed
6 tasks done
lanitochka17 opened this issue Jun 12, 2024 · 23 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Jun 12, 2024

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: 1.4.82-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat
  3. Submit an expense
  4. Track an expense
  5. Pay elsewhere the expense report
  6. Go to transaction thread of tracked expense
  7. Click 3-dot menu

Expected Result:

"Delete expense" option will not appear for paid tracked expense

Actual Result:

"Delete expense" option appears for paid tracked expense

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6511017_1718207360141.20240612_234631.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01bb7f209695580cf5
  • Upwork Job ID: 1802802568068548628
  • Last Price Increase: 2024-06-17
  • Automatic offers:
    • eh2077 | Reviewer | 102806652
    • bernhardoj | Contributor | 102806654
Issue OwnerCurrent Issue Owner: @kevinksullivan
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 12, 2024
Copy link

melvin-bot bot commented Jun 12, 2024

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

@lanitochka17
Copy link
Author

@kevinksullivan FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@cretadn22
Copy link
Contributor

Proposal

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

"Delete expense" option appears for paid tracked expense

What is the root cause of that problem?

const canDeleteRequest =
isActionOwner && (ReportUtils.canAddOrDeleteTransactions(moneyRequestReport) || ReportUtils.isTrackExpenseReport(transactionThreadReport)) && !isDeletedParentAction;

We manually add isTrackExpenseReport condition to display the delete option in paid track expense

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

Before we need to add isTrackExpenseReport condition because canAddOrDeleteTransactions doesn't cover track expense case. At present, let's remove isTrackExpenseReport condition because canAddOrDeleteTransactions also cover track expense case.

Consider to make the same fix to MoneyRequestHeader

What alternative solutions did you explore? (Optional)

@bernhardoj
Copy link
Contributor

Proposal

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

Delete expense option is shown for paid track expense.

What is the root cause of that problem?

The delete option is always shown for track expense report.

const canDeleteRequest = isActionOwner && (ReportUtils.canAddOrDeleteTransactions(moneyRequestReport) || ReportUtils.isTrackExpenseReport(report)) && !isDeletedParentAction;

This is useful for self DM track expense report because the moneyRequestReport is the parent report which is self DM,

const moneyRequestReport = parentReport;

so canAddOrDeleteTransactions returns false for selfDM track expense. In a normal money request or workspace track expense, we have IOU/expense report and then the transaction thread.

chat report -> money request report -> transaction thread

But in self DM track expense, we only have the track expense report/transaction thread

self DM -> track expense report

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

We need to also check whether the track expense is a self DM track or not.

const isSelfDMTrack = ReportUtils.isTrackExpenseReport(report) && ReportUtils.isSelfDM(parentReport);
const moneyRequestReport = !isSelfDMTrack ? parentReport : undefined; <- optional, just so it's more predictable
const canDeleteRequest = ... && (ReportUtils.canAddOrDeleteTransactions(moneyRequestReport) || isSelfDMTrack) && ...

We also have the same condition in MoneyReportHeader that is shown in the money request report, but self DM track doesn't have money request report, so we can remove it (remove ReportUtils.isTrackExpenseReport(report))

const canDeleteRequest =
isActionOwner && (ReportUtils.canAddOrDeleteTransactions(moneyRequestReport) || ReportUtils.isTrackExpenseReport(transactionThreadReport)) && !isDeletedParentAction;

What alternative solutions did you explore? (Optional)

In canAddOrDeleteTransactions, returns true if it's a self DM.

App/src/libs/ReportUtils.ts

Lines 1506 to 1509 in a451de4

function canAddOrDeleteTransactions(moneyRequestReport: OnyxEntry<Report>): boolean {
if (!isMoneyRequestReport(moneyRequestReport)) {
return false;
}

if (isSelfDM(moneyRequestReport)) return true

But I don't like this one because canAddOrDeleteTransactions is expected to work with a money request report.

Instead, we can add a new optional param to canAddOrDeleteTransactions called transactionReport and if transactionReport is a self DM track, then returns true.

@melvin-bot melvin-bot bot added the Overdue label Jun 14, 2024
Copy link

melvin-bot bot commented Jun 17, 2024

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

@kevinksullivan kevinksullivan added the External Added to denote the issue can be worked on by a contributor label Jun 17, 2024
@melvin-bot melvin-bot bot changed the title Track expense - "Delete expense" option appears for paid tracked expense [$250] Track expense - "Delete expense" option appears for paid tracked expense Jun 17, 2024
Copy link

melvin-bot bot commented Jun 17, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 17, 2024
Copy link

melvin-bot bot commented Jun 17, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Jun 17, 2024
@kevinksullivan
Copy link
Contributor

Moving to vip-vsb and making external. @eh2077 can you review the proposals above when you get a chance? Thanks!

@eh2077
Copy link
Contributor

eh2077 commented Jun 18, 2024

We should handle the special case of self DM track expense for the delete option. @bernhardoj 's proposal looks good to me.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Jun 18, 2024

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

@NikkiWines
Copy link
Contributor

Agreed @bernhardoj's proposal looks good 👍

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 20, 2024
Copy link

melvin-bot bot commented Jun 20, 2024

📣 @eh2077 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Jun 20, 2024

📣 @bernhardoj 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@bernhardoj
Copy link
Contributor

PR is ready

cc: @eh2077

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jul 3, 2024
@melvin-bot melvin-bot bot changed the title [$250] Track expense - "Delete expense" option appears for paid tracked expense [HOLD for payment 2024-07-10] [$250] Track expense - "Delete expense" option appears for paid tracked expense Jul 3, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 3, 2024
Copy link

melvin-bot bot commented Jul 3, 2024

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

Copy link

melvin-bot bot commented Jul 3, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.3-7 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 2024-07-10. 🎊

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

Copy link

melvin-bot bot commented Jul 3, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@eh2077] The PR that introduced the bug has been identified. Link to the PR:
  • [@eh2077] 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:
  • [@eh2077] A discussion in #expensify-bugs 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:
  • [@eh2077] Determine if we should create a regression test for this bug.
  • [@eh2077] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@kevinksullivan] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Jul 10, 2024
@eh2077
Copy link
Contributor

eh2077 commented Jul 14, 2024

Checklist

  • [@eh2077] The PR that introduced the bug has been identified. Link to the PR: I can't find the specific PR that is responsible for this bug. We missed this case when adding the track expense feature to workspace.
  • [@eh2077] 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: N/A
  • [@eh2077] A discussion in #expensify-bugs 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
  • [@eh2077] Determine if we should create a regression test for this bug. Yes

Regression test

  1. Open workspace chat
  2. Submit 1 expense and track 1 expense
  3. Open the expense report
  4. Pay the expense
  5. Open the track transaction thread
  6. Press the 3-dot button
  7. Verify there is no Delete expense option
  8. Open a self DM
  9. Track an expense
  10. Open the track report
  11. Press the 3-dot button
  12. Verify there is a Delete expense option

Do we agree 👍 or 👎

@bernhardoj
Copy link
Contributor

I requested the payment in ND.

Copy link

melvin-bot bot commented Jul 15, 2024

@NikkiWines, @kevinksullivan, @bernhardoj, @eh2077 Eep! 4 days overdue now. Issues have feelings too...

@kevinksullivan
Copy link
Contributor

Payment summary:

@melvin-bot melvin-bot bot removed the Overdue label Jul 15, 2024
@kevinksullivan
Copy link
Contributor

All set paying @eh2077

@JmillsExpensify
Copy link

$250 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 External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Archived in project
Development

No branches or pull requests

7 participants