Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.36k stars 2.78k forks source link

Scan-Billable option is displayed in confirmation page but not shown after creating expense #49800

Open mvtglobally opened 2 days ago

mvtglobally commented 2 days ago

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: v9.0.40-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. In old dot, enable default to billable
  2. Launch app
  3. Tap fab _ start chat - create room
  4. Create a room with workspace used in old dot to enable billable toggle
  5. Invite a user via suggestions
  6. Tap invite from whisper
  7. Tap plus icon -- split expense-- scan
  8. Upload an image by taking photo from camera
  9. Note enabled billable toggle shown in confirmation page
  10. Tap split expense
  11. Open the scan split expense and note billable option not shown
  12. Enter amount and tap split expense 13 Open the expense and tap show more
  13. Note billable option is not shown

Expected Result:

Billable option is displayed in confirmation page similarly it must be shown after creating scan split expense in room.

Actual Result:

Billable option is displayed in confirmation page but not shown after creating scan split expense in room.

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?

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/user-attachments/assets/6118edc3-2e84-4fdb-83ed-d5dd678fb74d

View all open jobs on GitHub

melvin-bot[bot] commented 2 days ago

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

abzokhattab commented 2 days ago

Edited by proposal-police: This proposal was edited at 2024-09-26 17:57:41 UTC.

Proposal

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

Scan-Billable option is displayed in confirmation page but not shown after creating expense

What is the root cause of that problem?

the policy id that is passed to the confirmation list component is passed as undefined incase of the split details because the report is not an expense chat

https://github.com/Expensify/App/blob/b080513d1c73ac9d7d3f840b0f68a102d70fce4f/src/pages/iou/SplitBillDetailsPage.tsx#L149

however when submiting an expense we call the IOU.getIOURequestPolicyID(transaction,report) to get the policy id

https://github.com/Expensify/App/blob/cffd880df2d8d545675b9ea46f116704510c9e91/src/pages/iou/request/step/IOURequestStepConfirmation.tsx#L630

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

to make it consisent we can update the value in the SplitBillDetailsPage to:

policyID={ReportUtils.isPolicyExpenseChat(report) ? report?.policyID : IOU.getIOURequestPolicyID(transaction,report)}

or we can make it having the same value:

policyID={IOU.getIOURequestPolicyID(transaction, report)}

Result

image

What alternative solutions did you explore? (Optional)

Nodebrute commented 2 days ago

Proposal

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

Billable option is displayed in confirmation page but not shown after creating expense

What is the root cause of that problem?

We are adding a check here isPolicyExpenseChat then we pass report?.policyID otherwise we are passing undefined as policyID. In our case the room is not policyExpenseChat it's chatType is policyRoom https://github.com/Expensify/App/blob/04b82bc10b5fd259bf8127546cebf757f8de85f6/src/pages/iou/SplitBillDetailsPage.tsx#L153 This is why the policy will be undefined here too causing shouldshowBillable to be false https://github.com/Expensify/App/blob/99b4c5a4563a5f65e1a0ac06fff12cd11e8b95e1/src/components/MoneyRequestConfirmationListFooter.tsx#L250

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

We can remove the check isPolicyExpenseChat from here https://github.com/Expensify/App/blob/04b82bc10b5fd259bf8127546cebf757f8de85f6/src/pages/iou/SplitBillDetailsPage.tsx#L153 We can do something like this.

       policyID={report?.policyID ?? '-1'}

What alternative solutions did you explore? (Optional)

Optionally we can simply do

 policyID={report?.policyID}