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-01-04] [$500] [Wave 6: Workspace Chats] IOU-The request created is not displayed in the manual expense created page. #32796

Closed
5 of 6 tasks
izarutskaya opened this issue Dec 11, 2023 · 35 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

@izarutskaya
Copy link

izarutskaya commented Dec 11, 2023

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.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:
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. Tap employee Workspace chat
  3. Tap on a exsisting manual expense which is created and submitted.( if not create a manual expense and submit it)
  4. Tap plus icon near compose
  5. Tap request money
  6. Enter amount
  7. Tap next
  8. Tap request

Expected Result:

On paid policy, if the expense report is not in open state, do not show the Request Money option in the menu on the expense report. Only in case the expense report is open.

This is only the case for paid policies

Actual Result:

The request created is not displayed in the manual expense created page.Request created is shown only in Worspace chat page.

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

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

Bug6308623_1702285574223.az_recorder_20231209_015344.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~010ae27c329f45f3a6
  • Upwork Job ID: 1734161470412218368
  • Last Price Increase: 2023-12-11
  • Automatic offers:
    • hoangzinh | Reviewer | 28062552
    • bernhardoj | Contributor | 28062553
Issue OwnerCurrent Issue Owner: @stephanieelliott
@izarutskaya izarutskaya 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 Dec 11, 2023
@melvin-bot melvin-bot bot changed the title IOU-The request created is not displayed in the manual expense created page. [$500] IOU-The request created is not displayed in the manual expense created page. Dec 11, 2023
Copy link

melvin-bot bot commented Dec 11, 2023

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

Copy link

melvin-bot bot commented Dec 11, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 11, 2023
Copy link

melvin-bot bot commented Dec 11, 2023

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

Copy link

melvin-bot bot commented Dec 11, 2023

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

@bernhardoj
Copy link
Contributor

bernhardoj commented Dec 11, 2023

Proposal

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

Creating a new request in a submitted expense report will create the money request action on the chat report instead on the expense report.

What is the root cause of that problem?

Currently, we allow user to request money on a submitted expense report.

App/src/libs/ReportUtils.ts

Lines 3725 to 3728 in 3d56ca3

* Users can request money:
* - in policy expense chats only if they are in a role of a member in the chat (in other words, if it's their policy expense chat)
* - in an open or submitted expense report tied to a policy expense chat the user owns
* - employee can request money in submitted expense report only if the policy has Instant Submit settings turned on

But after this PR, when we submit an expense report, we now clear the iouReportID so every new request won't be created on the submitted expense report and instead a new expense report is created.

App/src/libs/actions/IOU.js

Lines 2819 to 2830 in 3d56ca3

...(parentReport.reportID
? [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${parentReport.reportID}`,
value: {
...parentReport,
hasOutstandingIOU: false,
hasOutstandingChildRequest: false,
iouReportID: null,
},
},

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

Based on the new expected behavior, we want to hide the request money option if the expense report is not open, only for the paid policy.

(add this to canRequestMoney, we need to pass a new param policy from the component that uses this)

if (isMoneyRequestReport(report)) {
    const isOwnExpenseReport = isExpenseReport(report) && isOwnPolicyExpenseChat;
    if (isOwnExpenseReport && (policy.type === 'team' || policy.type === 'corporate')) {
        return isDraftExpenseReport(report);
    }

    return (isOwnExpenseReport || isIOUReport(report)) && !isReportApproved(report) && !isSettled(report?.reportID);
}

We will need to update the unit test too.

@yh-0218
Copy link
Contributor

yh-0218 commented Dec 11, 2023

I think this is expected result.

@hoangzinh
Copy link
Contributor

@bernhardoj thanks for your proposal. Can you get confirmation on the PR you mentioned that this is our expectation, not a regression bug? Thanks

we now clear the iouReportID so every new request won't be created on the submitted expense report and instead a new expense report is created.

@bernhardoj
Copy link
Contributor

Based on this comment on the PR, it's expected. But just to be safe, I think we can have @mountiny to have a look at this issue and the solution that I propose.

@hoangzinh
Copy link
Contributor

@mountiny do you mind taking a look at my comment here #32796 (comment)? Thanks

@mountiny
Copy link
Contributor

Ah good point, if this is paid policy, then we create open reports, once submitted new requests should go to a new open report.

So I think the solution would be that on the + icon in the non-open expense report on paid policy, we should hide the Request money option, you cannot request money from there but either from the workspace chat or from the Global create

@mountiny mountiny self-assigned this Dec 13, 2023
@hoangzinh
Copy link
Contributor

sorry @mountiny. Can you clarify what does "non-open expense report" mean? And will it apply also for free policy? Thanks

@mountiny
Copy link
Contributor

If the expense report is not a draft report. so the stateNum and statusNum are not 0.

Free policies, cannot have open reports so there we have logic that if the expense report is padi, you cannot request more money there

@hoangzinh
Copy link
Contributor

Thanks @mountiny for clarifying. @bernhardoj can you update your solution with the new expectation in the GH description? Thanks

@bernhardoj
Copy link
Contributor

@hoangzinh updated my proposal

@hoangzinh
Copy link
Contributor

@bernhardoj I don't think your solution is correct. According to @mountiny comment here #32796 (comment), free policy cannot have open reports. In other the words isDraftExpenseReport is always false for expense reports of a free policy

@bernhardoj
Copy link
Contributor

@hoangzinh yes, but we have this condition policy.type !== CONST.POLICY.TYPE.FREE.

Maybe we can switch the position of the condition.

@hoangzinh
Copy link
Contributor

@bernhardoj My point is do we need to check policy.type !== CONST.POLICY.TYPE.FREE?, because if I understand correctly, the function isDraftExpenseReport can cover both paid policy and free policy.

@bernhardoj
Copy link
Contributor

Ah, I see. Do you mean we can just do it like this?

// this will only return true on a paid policy expense report, right?
if (isDraftExpenseReport(report)) {
    return true;
}

@hoangzinh
Copy link
Contributor

Yeah right, and If I understand correctly. We might just replace isExpenseReport with isDraftExpenseReport in this LOC

@bernhardoj
Copy link
Contributor

Hmm, if we replace isExpenseReport with isDraftExpenseReport then we won't be able to request on a free policy expense report.

@mountiny
Copy link
Contributor

mountiny commented Dec 15, 2023

function canRequestMoneyOnThisMoneyRequestReport() {
  if (isExpenseReport) {
    if (policyType == free) {
      if (report.state ==1 && report.status ==1 ) {
        return true;
      }
    } else if (policyType == 'team' OR policyType == 'corporate') {
       if (report.state ==0 && report.status ==0 ) {
         return true;
       }
    }
  }
  if (isIOUReport) {
    if (state ==1 && status ==1 ) {
      return true;
     }
   }
   return false;
}

@bernhardoj
Copy link
Contributor

bernhardoj commented Dec 15, 2023

// this will only return true on a paid policy expense report, right?
if (isDraftExpenseReport(report)) {
return true;
}

I just tested and this doesn't work.

This is our current logic for the money request report.

App/src/libs/ReportUtils.ts

Lines 3793 to 3797 in 6785032

// User can request money in any IOU report, unless paid, but user can only request money in an expense report
// which is tied to their workspace chat.
if (isMoneyRequestReport(report)) {
return ((isExpenseReport(report) && isOwnPolicyExpenseChat) || isIOUReport(report)) && !isReportApproved(report) && !isSettled(report?.reportID);
}

If I would translate the above pseudo-code, then I think the new code would be:

if (isMoneyRequestReport(report)) {
    const isOwnExpenseReport = isExpenseReport(report) && isOwnPolicyExpenseChat;
    if (isOwnExpenseReport && (policy.type === 'team' || policy.type === 'corporate')) {
        return isDraftExpenseReport(report);
    }

    return (isOwnExpenseReport || isIOUReport(report)) && !isReportApproved(report) && !isSettled(report?.reportID);
}

@hoangzinh What do you think?

@hoangzinh
Copy link
Contributor

^ look good from me. What do you think @mountiny? #32796 (comment)

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 15, 2023
@mountiny
Copy link
Contributor

Looking swell lets go

Copy link

melvin-bot bot commented Dec 15, 2023

📣 @hoangzinh 🎉 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 Dec 15, 2023

📣 @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 Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Dec 15, 2023
@bernhardoj
Copy link
Contributor

PR is ready

cc: @hoangzinh

@hoangzinh
Copy link
Contributor

Thanks @bernhardoj , please don't forget to keep your proposal up-to-date with your comment here #32796 (comment)

@bernhardoj
Copy link
Contributor

@bernhardoj ah you're right, updated.

@greg-schroeder greg-schroeder changed the title [$500] IOU-The request created is not displayed in the manual expense created page. [$500] [Wave 6: Workspace Chats] IOU-The request created is not displayed in the manual expense created page. Dec 19, 2023
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Dec 28, 2023
@melvin-bot melvin-bot bot changed the title [$500] [Wave 6: Workspace Chats] IOU-The request created is not displayed in the manual expense created page. [HOLD for payment 2024-01-04] [$500] [Wave 6: Workspace Chats] IOU-The request created is not displayed in the manual expense created page. Dec 28, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Dec 28, 2023
Copy link

melvin-bot bot commented Dec 28, 2023

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

Copy link

melvin-bot bot commented Dec 28, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.18-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-01-04. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

Copy link

melvin-bot bot commented Dec 28, 2023

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:

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

@hoangzinh
Copy link
Contributor

Regression Test Proposal

  1. Sign in to an Expensify account that has a paid WS chat
  2. Go to that paid WS chat
  3. Request money in USD currency
  4. Press the request preview to open the IOU report
  5. Press the add action (+) button
  6. Verify there is a Request money option
  7. Submit the request
  8. Press the add action (+) button again
  9. Verify there is no Request money option

Do we agree 👍 or 👎

@hoangzinh
Copy link
Contributor

Hey, @bernhardoj do you find any regression PR causing this issue? I'm thinking this issue is a bug or an improvement.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jan 4, 2024
@stephanieelliott
Copy link
Contributor

stephanieelliott commented Jan 4, 2024

Summarizing payment on this issue:

Upwork job is here: https://www.upwork.com/jobs/~010ae27c329f45f3a6

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
Development

No branches or pull requests

6 participants