Skip to content

[HOLD for payment 2024-01-02] [$500] IOU -Admin is unable to add receipt on Employee's expense request but the placeholder displayed #32923

Closed

Description

@kbecciv

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.11-1
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. Log in as the employee
  2. Navigate to a expense request conversation that has a receipt
  3. Click on the receipt thumbnail
  4. Click on Delete Receipt from 3 dot menu on the top right
  5. Log in as admin
  6. Navigate to the expense from Step 2
  7. Click on "+" button from deleted receipt ( click once and click few times)

Expected Result:

Since placeholder shows up, admin should be able to add receipt

Actual Result:

Admin is unable to add receipt on Employee's expense request but the placeholder still shows up.
Clicking on it fast enough will redirect admin to report page.

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

Bug6310523_1702390701545.Recording__1539.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01a1dbb186e5ac4d8c
  • Upwork Job ID: 1734583185483804672
  • Last Price Increase: 2023-12-12
  • Automatic offers:
    • bernhardoj | Contributor | 28064656

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Dec 12, 2023
  2. changed the title [-]Web- IOU -Admin is unable to add receipt on Employee's expense request but the placeholder displayed[/-] [+][$500] Web- IOU -Admin is unable to add receipt on Employee's expense request but the placeholder displayed[/+] on Dec 12, 2023
  3. melvin-bot commented on Dec 12, 2023

    @melvin-bot
  4. melvin-bot commented on Dec 12, 2023

    @melvin-bot

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

  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Dec 12, 2023
  6. melvin-bot commented on Dec 12, 2023

    @melvin-bot

    Bug0 Triage Checklist (Main S/O)

    • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
    • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
      • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
    • This bug is reproducible using the reproduction steps in the OP. S/O
      • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
      • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
    • This issue is filled out as thoroughly and clearly as possible
      • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
    • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync
  7. melvin-bot commented on Dec 12, 2023

    @melvin-bot

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

  8. changed the title [-][$500] Web- IOU -Admin is unable to add receipt on Employee's expense request but the placeholder displayed[/-] [+][$500] IOU -Admin is unable to add receipt on Employee's expense request but the placeholder displayed[/+] on Dec 12, 2023
  9. bernhardoj commented on Dec 12, 2023

    @bernhardoj
    Contributor

    Proposal

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

    The empty receipt placeholder is shown for admin but pressing it do nothing.

    What is the root cause of that problem?

    We recently (last month) updated the app to prevent the admin from being able to update the receipt in this PR.

    If it's unable to edit, we will dismiss immediately the edit page.

    // Dismiss the modal when a current user cannot edit a money request.
    Navigation.isNavigationReady().then(() => {
    Navigation.dismissModal();
    });

    We already have a logic to not show the empty receipt placeholder if the user shouldn't be able to edit it.

    {!hasReceipt && canEdit && !isSettled && canUseViolations && (
    <ReceiptEmptyState
    hasError={hasErrors}
    onPress={() => Navigation.navigate(ROUTES.EDIT_REQUEST.getRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.RECEIPT))}
    />
    )}

    But canEdit refers to the ability of the user to edit the request as a whole, not a specific field.

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

    We should update the condition to not show the empty receipt placeholder if the user/admin can't edit/add the receipt.

    const canEditReceipt = ReportUtils.canEditFieldOfMoneyRequest(parentReportAction, moneyRequestReport.reportID, CONST.EDIT_REQUEST_FIELD.RECEIPT)
    
    -{!hasReceipt && canEdit && !isSettled && canUseViolations && (
    +{!hasReceipt && canEditReceipt && !isSettled && canUseViolations && (
        <ReceiptEmptyState
            hasError={hasErrors}
            onPress={() => Navigation.navigate(ROUTES.EDIT_REQUEST.getRoute(report.reportID, CONST.EDIT_REQUEST_FIELD.RECEIPT))}
        />
    )}

    (the above condition is taken from EditRequestPage)

    if (ReportUtils.canEditFieldOfMoneyRequest(parentReportAction, parentReport.reportID, fieldToEdit)) {
    return;
    }

  10. isabelastisser commented on Dec 14, 2023

    @isabelastisser
    Contributor

    @sobitneupane can you please review the proposal above? Thanks!

  11. isabelastisser commented on Dec 15, 2023

    @isabelastisser
    Contributor

    Bump @sobitneupane for urgency. Thanks!

  12. 17 remaining items

  13. melvin-bot commented on Dec 26, 2023

    @melvin-bot

    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:

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

    @isabelastisser
    Contributor

    Payment summary:

    @sobitneupane $500 for C+ review / Requires payment through NewDot Manual Requests.
    @bernhardoj, $500 for fixing the issue. Payment processed in Upwork.

  15. isabelastisser commented on Jan 2, 2024

    @isabelastisser
    Contributor

    @sobitneupane Please complete the checklist so I can close this issue. Thanks!

  16. isabelastisser commented on Jan 3, 2024

    @isabelastisser
    Contributor
  17. isabelastisser commented on Jan 5, 2024

    @isabelastisser
    Contributor

    @sobitneupane, please provide an update!

  18. sobitneupane commented on Jan 5, 2024

    @sobitneupane
    Contributor

    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:

    • [@sobitneupane] The PR that introduced the bug has been identified. Link to the PR:

    #31024

    • [@sobitneupane] 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:

    #31024 (comment)

    • [@sobitneupane] 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:

    It was missed during the testing of linked PR.

    • [@sobitneupane] Determine if we should create a regression test for this bug.

    Yes.

    • [@sobitneupane] 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.

    #32923 (comment)

  19. sobitneupane commented on Jan 5, 2024

    @sobitneupane
    Contributor

    Regression Test Proposal:

    • As an employee, request money on the policy expense chat or open an existing money request detail
    • (If there is a receipt, delete/remove it) Verify there is an add receipt thumbnail.
    • As an admin, open the money request detail
    • Verify add receipt thumbnail is hidden

    Do we agree 👍 or 👎

  20. isabelastisser commented on Jan 5, 2024

    @isabelastisser
    Contributor

    [@isabelastisser] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

    https://github.com/Expensify/Expensify/issues/357292

  21. isabelastisser commented on Jan 5, 2024

    @isabelastisser
    Contributor

    All set!

  22. JmillsExpensify commented on Feb 14, 2024

    @JmillsExpensify
    Contributor

    $500 approved for @sobitneupane based on this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions