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-02-19] [$500] IOU -Deleting submitted report shows unexpected error with amount crossed out #34538

Closed
3 of 6 tasks
lanitochka17 opened this issue Jan 15, 2024 · 30 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 Jan 15, 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.25
Reproducible in staging?: Y
Reproducible in production?: Y
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:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Launch app
  2. Login employee account
  3. Tap on employee workspace chat
  4. Tap plus icon near compose-- request money manual
  5. Enter an amount and tap next
  6. Enter merchant field
  7. Tap request
  8. Tap submit
  9. Open submitted IOU to open IOU detail page
  10. Tap 3 dots on top right and tap delete and confirm delete request

Expected Result:

User must not be shown option/allowed to delete submitted report & error should not be displayed with amount crossed out

Actual Result:

In employee WS, create manual request and submit it. User shown option/allowed to delete submitted report and deleted report shows unexpected error with amount crossed out

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

Bug6343590_1705353673385.rep.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0165e8908305facf78
  • Upwork Job ID: 1747014776873512960
  • Last Price Increase: 2024-01-22
  • Automatic offers:
    • s77rt | Reviewer | 28134406
    • bernhardoj | Contributor | 28134407
@lanitochka17 lanitochka17 added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jan 15, 2024
@melvin-bot melvin-bot bot changed the title IOU - Android-Deleting submitted report shows unexpected error with amount crossed out [$500] IOU - Android-Deleting submitted report shows unexpected error with amount crossed out Jan 15, 2024
Copy link

melvin-bot bot commented Jan 15, 2024

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

Copy link

melvin-bot bot commented Jan 15, 2024

Triggered auto assignment to @sakluger (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

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

melvin-bot bot commented Jan 15, 2024

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

@bernhardoj
Copy link
Contributor

Proposal

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

Deleting a submitted money request gives an error.

What is the root cause of that problem?

We are not hiding the delete button when the money request is submitted. We only hide it if it's approved or settled.

const canModifyRequest = isActionOwner && !isSettled && !isApproved && !ReportActionsUtils.isDeletedAction(parentReportAction);

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

We need to hide it if the money request is submitted. To know whether it's submitted or not, we can use the same check-in #32796, specifically:

App/src/libs/ReportUtils.ts

Lines 3815 to 3818 in 8e2fb67

const isOwnExpenseReport = isExpenseReport(report) && isOwnPolicyExpenseChat;
if (isOwnExpenseReport && PolicyUtils.isPaidGroupPolicy(policy)) {
return isDraftExpenseReport(report);
}

We only check the submitted status (isDraftExpenseReport true means open, not submitted) in an expense report that is linked with a paid policy.

We need to apply this check in both MoneyRequestHeader and in ReportUtils.canDeleteReportAction.

App/src/libs/ReportUtils.ts

Lines 1139 to 1141 in 8e2fb67

if (isActionOwner) {
return true;
}

if (isActionOwner) {
    if (isExpenseReport(report) && PolicyUtils.isPaidGroupPolicy(policy)) {
        return isDraftExpenseReport(report);
    }
    return true;
}

threeDotsMenuItems.push({
icon: Expensicons.Trashcan,
text: translate('reportActionContextMenu.deleteAction', {action: parentReportAction}),
onSelected: () => setIsDeleteModalVisible(true),
});

if (ReportUtils.isExpenseReport(moneyRequestReport) && PolicyUtils.isPaidGroupPolicy(policy)) {
    if (ReportUtils.isDraftExpenseReport(moneyRequestReport)) {
        threeDotsMenuItems.push({
            icon: Expensicons.Trashcan,
            text: translate('reportActionContextMenu.deleteAction', {action: parentReportAction}),
            onSelected: () => setIsDeleteModalVisible(true),
        });
    }
} else {
    threeDotsMenuItems.push({
        icon: Expensicons.Trashcan,
        text: translate('reportActionContextMenu.deleteAction', {action: parentReportAction}),
        onSelected: () => setIsDeleteModalVisible(true),
    });
}

@0xmiros
Copy link
Contributor

0xmiros commented Jan 18, 2024

@sakluger once submitted (but not approved yet), request should not be deletable? I believe so but just to confirm

@melvin-bot melvin-bot bot added the Overdue label Jan 22, 2024
Copy link

melvin-bot bot commented Jan 22, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@sakluger
Copy link
Contributor

I'm checking on correct expected behavior in Slack: https://expensify.slack.com/archives/C02MW39LT9N/p1706052284329559

@melvin-bot melvin-bot bot removed the Overdue label Jan 23, 2024
@mallenexpensify mallenexpensify added External Added to denote the issue can be worked on by a contributor and removed External Added to denote the issue can be worked on by a contributor labels Jan 24, 2024
Copy link

melvin-bot bot commented Jan 24, 2024

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

@mallenexpensify
Copy link
Contributor

@s77rt reassigning, please take over as C+. If you don't have bandwidth, unassign yourself. Thanks

@sakluger
Copy link
Contributor

It's not clear from the reproduction steps, but if Instant Submit is enabled on the workspace, then a submitter should be able to delete an expense on a processing report, but there should be no errors (currently we see the error Unexpected error deleting the money request, please try again later).

@s77rt
Copy link
Contributor

s77rt commented Jan 24, 2024

@sakluger I think instant submit is only enabled on free policies. Asked for confirmation here https://expensify.slack.com/archives/C01GTK53T8Q/p1706122924561169

@s77rt
Copy link
Contributor

s77rt commented Jan 24, 2024

I'm not able to reproduce this due to billing issues (in olddot). I asked for help here https://expensify.slack.com/archives/C02NK2DQWUX/p1706122093870419. Regardless this is not a blocker. I agree with @bernhardoj. We should hide the delete money request button if the expense report is already submitted (for paid policies only).

🎀 👀 🎀 C+ reviewed
Link to proposal

PS: @bernhardoj There is a util function isPaidGroupPolicyExpenseReport

Copy link

melvin-bot bot commented Jan 24, 2024

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

@s77rt
Copy link
Contributor

s77rt commented Jan 24, 2024

@Gonals Please check the two linked slack threads above ^ Thanks!

@kbecciv kbecciv changed the title [$500] IOU - Android-Deleting submitted report shows unexpected error with amount crossed out [$500] IOU -Deleting submitted report shows unexpected error with amount crossed out Jan 26, 2024
@melvin-bot melvin-bot bot added the Overdue label Jan 29, 2024
Copy link

melvin-bot bot commented Feb 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 📖

@Gonals
Copy link
Contributor

Gonals commented Feb 1, 2024

I agree with the proposal. I can test with paid policies if needed

@melvin-bot melvin-bot bot removed the Overdue label Feb 1, 2024
@bernhardoj
Copy link
Contributor

Just retested and now I can delete the submitted request.

Screen.Recording.2024-02-01.at.19.24.56.mov

It's weird though seeing the submitted amount as 0. Do we still want to disable the delete button?

@Gonals @s77rt

@s77rt
Copy link
Contributor

s77rt commented Feb 1, 2024

@bernhardoj I'm still seeing an error. Maybe you are viewing the optimistic onyx values?

Screen.Recording.2024-02-01.at.11.48.24.PM.mov

@bernhardoj
Copy link
Contributor

@s77rt ah, I think I know why now. If I were an admin of the collect workspace, then I could delete the submitted expense report. But if I were a member/employee, then I can't.

The question is, do we want to disable the delete of submitted expenses for both admin and member?

@s77rt
Copy link
Contributor

s77rt commented Feb 2, 2024

In this case we should disable the button only for members. We should match the BE behaviour.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Feb 3, 2024
@bernhardoj
Copy link
Contributor

PR is ready

cc: @s77rt

Copy link

melvin-bot bot commented Feb 9, 2024

⚠️ 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.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Feb 12, 2024
@melvin-bot melvin-bot bot changed the title [$500] IOU -Deleting submitted report shows unexpected error with amount crossed out [HOLD for payment 2024-02-19] [$500] IOU -Deleting submitted report shows unexpected error with amount crossed out Feb 12, 2024
Copy link

melvin-bot bot commented Feb 12, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 12, 2024
Copy link

melvin-bot bot commented Feb 12, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.39-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-02-19. 🎊

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

Copy link

melvin-bot bot commented Feb 12, 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:

  • [@s77rt] The PR that introduced the bug has been identified. Link to the PR:
  • [@s77rt] 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:
  • [@s77rt] 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:
  • [@s77rt] Determine if we should create a regression test for this bug.
  • [@s77rt] 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:

@s77rt
Copy link
Contributor

s77rt commented Feb 13, 2024

  • The PR that introduced the bug has been identified: This seems to be a bug since day one, Add DeleteMoneyRequest #19095
  • The offending PR has been commented on: Add DeleteMoneyRequest #19095 (comment)
  • A discussion in #expensify-bugs has been started: Not needed. More like a onetime bug
  • Determine if we should create a regression test for this bug: Yes

Regression Test Proposal

Requires a paid workspace e.g. collect workspace

  1. Login as an employee
  2. Create a new money request
  3. Submit the expense report
  4. Go to the money request and Verify you cannot delete it
  5. Login as an admin
  6. Go to the money request and Verify you can delete it

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Feb 18, 2024
@sakluger
Copy link
Contributor

Thanks @s77rt for completing the BZ checklist ahead of time!

Everyone has been paid out. 🙇

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
None yet
Development

No branches or pull requests

7 participants