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-17] [$250] Track - Missing "Delete expense" in report details page when expense is tracked in self DM #44334

Closed
6 tasks done
lanitochka17 opened this issue Jun 24, 2024 · 36 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 24, 2024

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.0.1-10
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. Go to + > Track expense > Manual
  4. Track an expense
  5. Go to transaction thread
  6. Click on the chat header
  7. Note that "Delete expense" is present in report details page
  8. Go to self DM.
  9. Track an expense
  10. Go to transaction thread
  11. Click on the chat header

Expected Result:

"Delete expense" will be present in report details page when expense is tracked in self DM

Actual Result:

"Delete expense" is not present in report details page when expense is tracked in self DM

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

Bug6523362_1719259207236.20240625_035453.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01bb4860cbcf9ab40f
  • Upwork Job ID: 1806787222801178404
  • Last Price Increase: 2024-06-28
  • Automatic offers:
    • bernhardoj | Contributor | 102950333
Issue OwnerCurrent Issue Owner: @sakluger
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 24, 2024
Copy link

melvin-bot bot commented Jun 24, 2024

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

@sakluger 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

@lanitochka17
Copy link
Author

We think that this bug might be related to #vip-vsp

@dominictb
Copy link
Contributor

dominictb commented Jun 24, 2024

Proposal

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

"Delete expense" is not present in report details page when expense is tracked in self DM

What is the root cause of that problem?

  • In case of track expense report, transactionThreadReport or transactionThreadReportID is undefined because the report.type is chat. So in this:

    const transactionThreadReportID = useMemo(
    () => ReportActionsUtils.getOneTransactionThreadReportID(report.reportID, reportActions ?? [], isOffline),
    [report.reportID, reportActions, isOffline],
    );

    transactionThreadReportID is undefined because of this:
    if (report?.type !== CONST.REPORT.TYPE.IOU && report?.type !== CONST.REPORT.TYPE.EXPENSE && report?.type !== CONST.REPORT.TYPE.INVOICE) {
    return;
    }

  • Then, we use ReportUtils.isTrackExpenseReport(transactionThreadReport) in:

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

    to check if we can delete a request and in this case, canDeleteRequest is false because ReportUtils.isTrackExpenseReport(transactionThreadReport) is false.

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

  • Should use ReportUtils.isTrackExpenseReport(report) instead

What alternative solutions did you explore? (Optional)

@gijoe0295
Copy link
Contributor

gijoe0295 commented Jun 24, 2024

Proposal

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

"Delete expense" is not present in report details page when expense is tracked in self DM

What is the root cause of that problem?

Track expense report is a single transaction view. In other words, it is the thread transaction report itself.

But the condition here using transactionThreadReport to check for isTrackExpenseReport is not correct because track expense report does not have transaction thread report.

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

This condition is copied from MoneyReportHeader which is only used for money request report so it's not correct.

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

Use report itself as a fallback to check for isTrackExpenseReport if transactionThreadReport does not exist as already used in MoneyRequestHeader:

const changeMoneyRequestStatus = () => {

ReportUtils.isTrackExpenseReport(transactionThreadReport ?? report)

@dominictb
Copy link
Contributor

Proposal updated

  • I updated the RCA

@bernhardoj
Copy link
Contributor

Proposal

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

Missing delete expense option in self DM track expense report details page.

What is the root cause of that problem?

The condition to show the delete expense is shown as below:

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

The condition that fails in self DM track is ReportUtils.canAddOrDeleteTransactions(moneyRequestReport) and ReportUtils.isTrackExpenseReport(transactionThreadReport). transactionThreadReport is from the one-transaction report thread.

const transactionThreadReportID = useMemo(
() => ReportActionsUtils.getOneTransactionThreadReportID(report.reportID, reportActions ?? [], isOffline),
[report.reportID, reportActions, isOffline],
);
const [transactionThreadReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReportID}`);

For self DM track, transactionThreadReport is undefined because it's not a one-transaction report and moneyRequestReport (the parent report) is a self DM report, so canAddOrDeleteTransactions returns false.

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

The ReportUtils.isTrackExpenseReport condition is copied from the MoneyRequestHeader and it's added to show the delete expense option for self DM track expense, so using transactionThreadReport doesn't make sense.

Instead, we should check if it's a self DM track or not with below condition:
const isSelfDMTrack = ReportUtils.isTrackExpenseReport(report) && ReportUtils.isSelfDM(parentReport);
So, the condition will be:

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

This is the same solution with my proposal here but on a different component and case.

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

melvin-bot bot commented Jun 28, 2024

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

@sakluger sakluger added the External Added to denote the issue can be worked on by a contributor label Jun 28, 2024
@melvin-bot melvin-bot bot changed the title Track - Missing "Delete expense" in report details page when expense is tracked in self DM [$250] Track - Missing "Delete expense" in report details page when expense is tracked in self DM Jun 28, 2024
Copy link

melvin-bot bot commented Jun 28, 2024

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

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

melvin-bot bot commented Jun 28, 2024

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

@melvin-bot melvin-bot bot removed the Overdue label Jun 28, 2024
@jayeshmangwani
Copy link
Contributor

I agree with @bernhardoj 's Proposal to check the isSelfDM condition for the canDeleteRequest check. LGTM 🚀

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Jul 1, 2024

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

@dominictb

This comment was marked as outdated.

@jayeshmangwani
Copy link
Contributor

@dominictb I see that your comment has been marked as outdated. Is there anything I can help with regarding the selected proposal?

@dominictb
Copy link
Contributor

@jayeshmangwani Thanks. I got a result why we need to check isSelfDM, so I marked my question as outdated. And the selected proposal LGTM.

@jayeshmangwani
Copy link
Contributor

Thanks for the understanding!

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

melvin-bot bot commented Jul 1, 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 📖

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production labels Jul 10, 2024
@melvin-bot melvin-bot bot changed the title [$250] Track - Missing "Delete expense" in report details page when expense is tracked in self DM [HOLD for payment 2024-07-17] [$250] Track - Missing "Delete expense" in report details page when expense is tracked in self DM Jul 10, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 10, 2024
Copy link

melvin-bot bot commented Jul 10, 2024

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

Copy link

melvin-bot bot commented Jul 10, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.5-13 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-17. 🎊

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

Copy link

melvin-bot bot commented Jul 10, 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:

  • [@jayeshmangwani] The PR that introduced the bug has been identified. Link to the PR:
  • [@jayeshmangwani] 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:
  • [@jayeshmangwani] 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:
  • [@jayeshmangwani] Determine if we should create a regression test for this bug.
  • [@jayeshmangwani] 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.
  • [@sakluger] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@bernhardoj
Copy link
Contributor

I'll request in ND once payment is due.

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Jul 15, 2024
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2024-07-17] [$250] Track - Missing "Delete expense" in report details page when expense is tracked in self DM [HOLD for payment 2024-07-22] [HOLD for payment 2024-07-17] [$250] Track - Missing "Delete expense" in report details page when expense is tracked in self DM Jul 15, 2024
Copy link

melvin-bot bot commented Jul 15, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.6-8 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-22. 🎊

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

Copy link

melvin-bot bot commented Jul 15, 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:

  • [@jayeshmangwani] The PR that introduced the bug has been identified. Link to the PR:
  • [@jayeshmangwani] 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:
  • [@jayeshmangwani] 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:
  • [@jayeshmangwani] Determine if we should create a regression test for this bug.
  • [@jayeshmangwani] 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.
  • [@sakluger] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@bernhardoj
Copy link
Contributor

The payment should be due tomorrow (07-17)

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 16, 2024
@sakluger sakluger changed the title [HOLD for payment 2024-07-22] [HOLD for payment 2024-07-17] [$250] Track - Missing "Delete expense" in report details page when expense is tracked in self DM [HOLD for payment 2024-07-17] [$250] Track - Missing "Delete expense" in report details page when expense is tracked in self DM Jul 16, 2024
@sakluger
Copy link
Contributor

Thanks @bernhardoj! I'll complete payments tomorrow.

@jayeshmangwani could you please complete the BZ checklist?

@bernhardoj
Copy link
Contributor

I requested in ND.

@jayeshmangwani
Copy link
Contributor

Regression Test Proposal

  1. Open self DM.
  2. Track a new expense.
  3. Open the track expense report.
  4. Press the header.
  5. Verify that there is a "Delete expense" option.

Do we agree 👍 or 👎

@bernhardoj
Copy link
Contributor

@sakluger hi, I have requested the payment in ND (not paid yet). Can/should I refund the upwork so I get paid in ND?

@sakluger
Copy link
Contributor

@bernhardoj, I'm sorry - I missed your comment about requesting in NewDot. Let me find out if it's possible to reverse the Upwork payment.

@sakluger
Copy link
Contributor

Hi @bernhardoj - I requested a refund in Upwork. Can you please confirm the refund and let me know once you have done so?

@bernhardoj
Copy link
Contributor

@sakluger I have issued the refund

@sakluger
Copy link
Contributor

Summarizing payment on this issue:

Contributor: @bernhardoj $250, please request on NewDot
Contributor+: @jayeshmangwani $250, please request on Newdot

@JmillsExpensify
Copy link

$250 approved for @bernhardoj

@jayeshmangwani
Copy link
Contributor

Requested $250

@JmillsExpensify
Copy link

$250 approved for @jayeshmangwani

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

8 participants