App icon indicating copy to clipboard operation
App copied to clipboard

Add report action for deleting expenses off of processing reports

Open garrettmknight opened this issue 1 year ago • 5 comments

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: N/A Reproducible in staging?: N/A Reproducible in production?: N/A If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: None Issue reported by: @sakluger Slack conversation (hyperlinked to channel name): It's in eng, but it's more #expense

Action Performed:

  1. Create new workspace (Instant Submit will be enabled by default)
  2. Enable Approvals
  3. Invite Submitter A
  4. Have Submitter A create an expense
  5. Have Submitter A delete the expense

Expected Result:

When we make a change to an expense on a processing report, we add a report action indicating the change. We'd expect to see something like:

User Name deleted an expense on this report, [Merchant] - [Amount]

If it was me deleting it, it'd look like this:

Garrett Knight deleted an expense on this report, Nando's - £12.77

Actual Result:

The expense is deleted without a trace, confusing approvers when they've seen that an expense was once on the report.

Workaround:

None

Platforms:

All

Screenshots/Videos

Add any screenshot/video evidence

View all open jobs on GitHub

garrettmknight avatar Dec 03 '24 17:12 garrettmknight

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

melvin-bot[bot] avatar Dec 03 '24 17:12 melvin-bot[bot]

Proposal

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

The expense is deleted without a trace, confusing approvers when they've seen that an expense was once on the report.

What is the root cause of that problem?

When we delete a money request, we don't add any report action to keep track of the change

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

  1. Define a new report action for delete expense like DELETE_EXPENSE

  2. In deleteMoneyRequest, create an optimistic action, remove pendingAction in sucessData, and add an error in failureData in the expense report if shouldDeleteIOUReport is false and the report is a processing report. This action will have some data in originalMessage like amount, merchant, currency

https://github.com/Expensify/App/blob/ce282d38777e9e0a267e1b6f44bff9c4aace98ee/src/libs/actions/IOU.ts#L5735

  1. Add the deleteExpenseReportActionID param as the reportActionID of the optimistic action above here

https://github.com/Expensify/App/blob/ce282d38777e9e0a267e1b6f44bff9c4aace98ee/src/libs/actions/IOU.ts#L5962

  1. Define a function to get the translation for the action and
  • Add a case for this action here for the alternative text in LHN

  • Add a case in ReportActionItem here for the action in ReportScreen

  • Add a case in getReportName function here for thread header translation

  • Add a case in here for the copy message

  1. Require backend change
  • Introduce a new param in DeleteMoneyRequest API like deleteExpenseReportActionID and use this ID to generate a new delete expense action and return it to front end.

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

We can define a new test case in IOUTest here. We need to create mock data accordingly and verify a new delete expense action is created in this case when we call DeleteMoneyRequest API.

https://github.com/Expensify/App/blob/ce282d38777e9e0a267e1b6f44bff9c4aace98ee/tests/actions/IOUTest.ts#L1910

What alternative solutions did you explore? (Optional)

NA

nkdengineer avatar Dec 04 '24 05:12 nkdengineer

@youssef-lr, @zanyrenney Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Dec 09 '24 09:12 melvin-bot[bot]

hey @youssef-lr are you working on this one, or should we be assigning external for them to review the proposal above? Thanks!

zanyrenney avatar Dec 10 '24 12:12 zanyrenney

@zanyrenney I should have the backend PRs ready today, but we can also assign someone to work on the frontend PRs. @nkdengineer's proposal LGTM, except that we should only record this action if the report is PROCESSING.

youssef-lr avatar Dec 10 '24 12:12 youssef-lr

Made some progress locally and should have the first Auth PR ready by EOD

youssef-lr avatar Dec 12 '24 01:12 youssef-lr

great update, thank you so much @youssef-lr !

zanyrenney avatar Dec 12 '24 17:12 zanyrenney

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

melvin-bot[bot] avatar Dec 12 '24 17:12 melvin-bot[bot]

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

melvin-bot[bot] avatar Dec 12 '24 17:12 melvin-bot[bot]

❌ There was an error making the offer to @nkdengineer for the Contributor role. The BZ member will need to manually hire the contributor.

melvin-bot[bot] avatar Dec 12 '24 17:12 melvin-bot[bot]

📣 @brunovjk 🎉 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

melvin-bot[bot] avatar Dec 12 '24 17:12 melvin-bot[bot]

❌ There was an error making the offer to @nkdengineer for the Contributor role. The BZ member will need to manually hire the contributor.

melvin-bot[bot] avatar Dec 12 '24 17:12 melvin-bot[bot]

I had to make PRs in the other repos to test stuff so that shifted my focus away from finishing the tests of the Auth PR. It should be ready tomorrow for review. @nkdengineer you can continue working starting from this draft PR https://github.com/Expensify/App/pull/54079, please make a branch off of it.

youssef-lr avatar Dec 12 '24 23:12 youssef-lr

@youssef-lr Do I need to create a new branch or will work on this?

nkdengineer avatar Dec 13 '24 08:12 nkdengineer

I'm not sure you can continue working on that PR permission-wise? I think it's best to make a new branch from it. Once you have a draft PR ready please assign me to review I may suggest some changes early.

youssef-lr avatar Dec 13 '24 20:12 youssef-lr

Just made the Auth PR ready for review. I'll request review first thing on Monday.

youssef-lr avatar Dec 14 '24 23:12 youssef-lr

@youssef-lr we have a draft PR here

nkdengineer avatar Dec 16 '24 08:12 nkdengineer

@youssef-lr @zanyrenney @brunovjk @nkdengineer this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

melvin-bot[bot] avatar Dec 17 '24 09:12 melvin-bot[bot]

Any updates @youssef-lr for us? Thanks :D

brunovjk avatar Dec 18 '24 10:12 brunovjk

we're just waiting on another backend PR to get deployed

youssef-lr avatar Dec 19 '24 16:12 youssef-lr

@youssef-lr, @zanyrenney, @brunovjk, @nkdengineer Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Dec 23 '24 09:12 melvin-bot[bot]

we're just waiting on another backend PR to get deployed

Update: Still waiting to test the PR

brunovjk avatar Dec 23 '24 10:12 brunovjk

@youssef-lr, @zanyrenney, @brunovjk, @nkdengineer Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

melvin-bot[bot] avatar Dec 27 '24 09:12 melvin-bot[bot]

@youssef-lr @zanyrenney @brunovjk @nkdengineer this issue is now 4 weeks old, please consider:

  • Finding a contributor to fix the bug
  • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
  • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

Thanks!

melvin-bot[bot] avatar Dec 31 '24 09:12 melvin-bot[bot]

@youssef-lr, @zanyrenney, @brunovjk, @nkdengineer 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

melvin-bot[bot] avatar Dec 31 '24 09:12 melvin-bot[bot]

👋 @youssef-lr, I tested nkdengineer's draft PR and it seems the BE is already implemented—could you confirm and advise on the next steps? Thank you :D

brunovjk avatar Jan 01 '25 15:01 brunovjk

bump @youssef-lr please can you respond to the message above and let us know the next steps here please? Thank you!

zanyrenney avatar Jan 06 '25 13:01 zanyrenney

Yes the backend is done. Can we resume the frontend PR?

youssef-lr avatar Jan 06 '25 15:01 youssef-lr

Now it's up to you @nkdengineer. Thank you all.

brunovjk avatar Jan 06 '25 15:01 brunovjk

Will open PR soon

nkdengineer avatar Jan 09 '25 03:01 nkdengineer