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.53k stars 2.88k forks source link

[HOLD for payment 2023-12-20] [$500] IOU - Currency edit is saved when the edit is discarded in confirmation page #32826

Closed kbecciv closed 10 months ago

kbecciv commented 11 months 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: v1.4.11-1 Reproducible in staging?: y Reproducible in production?: n 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. Go to staging.new.expensify.com.
  2. Go to 1:1 DM > + > Request money.
  3. Enter amount > Next.
  4. On confirmation page, click Amount.
  5. Click on the currency and select a different currency.
  6. Click back button.

Expected Result:

The previous currency is preserved as the new currency is not saved.

Actual Result:

The new currency is saved when the changes are discarded.

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/Expensify/App/assets/93399543/205d37a8-18fd-4b62-9634-5eb062d8d7c1

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~018f3d94b5f2243152
  • Upwork Job ID: 1734278105112006656
  • Last Price Increase: 2023-12-11
  • Automatic offers:
    • c3024 | Reviewer | 28037137
    • s-alves10 | Contributor | 28037138
    • situchan | Contributor | 28038451
github-actions[bot] commented 11 months ago

:wave: Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.
melvin-bot[bot] commented 11 months ago

Triggered auto assignment to @blimpich (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

s-alves10 commented 11 months ago

Proposal

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

Currency edit is saved when the edit amount page is discarded in confirmation page

What is the root cause of that problem?

https://github.com/Expensify/App/blob/55903d45103ad446cb891dd1099d4e1dd7ea1ec1/src/pages/iou/request/step/IOURequestStepCurrency.js#L81

As you can see above, we save the currency data when select the currency.

This is the root cause

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

We need to implement the logic used here: use of currency query parameter

  1. Update https://github.com/Expensify/App/blob/14ef2a2f6829cd22e90b5d93e444089640c5807a/src/pages/iou/request/step/IOURequestStepAmount.js#L38-L42 to

    route: {
        params: {iouType, reportID, transactionID, backTo, currency: selectedCurrency},
    },
    transaction,
    transaction: {currency: originalCurrency},

    and define currency as

    const currency = selectedCurrency ?? originalCurrency;
  2. Move the below code to here https://github.com/Expensify/App/blob/14ef2a2f6829cd22e90b5d93e444089640c5807a/src/pages/iou/request/step/IOURequestStepCurrency.js#L81

  3. Add an optional argument currency to the navigateBack and update the function like

    const navigateBack = (currency = undefined) => {
        if (pageIndex === 'confirm') {
            const routeToAmountPageWithConfirmationAsBackTo = getUrlWithBackToParam(backTo, `/${ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(iouType, transactionID, reportID)}`);
            Navigation.navigate(`${routeToAmountPageWithConfirmationAsBackTo}${currency ? `&currency=${currency}` : ''}`);
            return;
        }
        Navigation.goBack(backTo || ROUTES.HOME);
    };
  4. Update https://github.com/Expensify/App/blob/14ef2a2f6829cd22e90b5d93e444089640c5807a/src/pages/iou/request/step/IOURequestStepCurrency.js#L79-L83 to

    const confirmCurrencySelection = (option) => {
        Keyboard.dismiss();
        navigateBack(option.currencyCode);
    };

This works as expected

What alternative solutions did you explore? (Optional)

blimpich commented 11 months ago

I'm looking at this. Taking some time to understand the code before deciding on anything. @s-alves I've reviewed your proposal and like it, but I'm going to briefly spend some time seeing if adding the data to the url is the best way to do this. I will update this issue hourly and decide as soon as I can on how to proceed.

blimpich commented 11 months ago

Okay after looking at the code and understanding a bit more I think your solution @s-alves10 is definitely what we want. Thank you for your patience. Assigning you.

melvin-bot[bot] commented 11 months ago

Job added to Upwork: https://www.upwork.com/jobs/~018f3d94b5f2243152

melvin-bot[bot] commented 11 months ago

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

melvin-bot[bot] commented 11 months ago

Bug0 Triage Checklist (Main S/O)

melvin-bot[bot] commented 11 months ago

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

melvin-bot[bot] commented 11 months ago

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

melvin-bot[bot] commented 11 months ago

Bug0 Triage Checklist (Main S/O)

melvin-bot[bot] commented 11 months ago

Current assignee @c3024 is eligible for the External assigner, not assigning anyone new.

melvin-bot[bot] commented 11 months ago

📣 @c3024 🎉 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

melvin-bot[bot] commented 11 months ago

📣 @s-alves10 🎉 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 📖

blimpich commented 11 months ago

Looks related to: https://github.com/Expensify/App/pull/28618/. Not going to revert that as that PR is huge and important and we have a solution proposed.

s-alves10 commented 11 months ago

@c3024

PR is ready for review https://github.com/Expensify/App/pull/32851

luacmartins commented 11 months ago

Requested an expedited C+ review here

melvin-bot[bot] commented 11 months ago

📣 @situchan 🎉 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 📖

Julesssss commented 11 months ago

Merged and CP'd

Christinadobrzyn commented 11 months ago

I'm not sure if this should remain open to be paid or if there's nothing to pay since this was a regression @Julesssss or @luacmartins could you clarify?

luacmartins commented 11 months ago

We should pay @s-alves10 for the fix and @situchan for the review

Christinadobrzyn commented 11 months ago

Awesome thanks @luacmartins

Following this PR for payment - https://github.com/Expensify/App/pull/32851

melvin-bot[bot] commented 11 months ago

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

melvin-bot[bot] commented 11 months ago

The solution for this issue has been :rocket: deployed to production :rocket: in version 1.4.11-25 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-12-20. :confetti_ball:

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.

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

melvin-bot[bot] commented 11 months ago

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:

Christinadobrzyn commented 10 months ago

Ready for payment. Payouts due:

Issue Reporter: NA Contributor: $500 @s-alves10 (paid in Upwork) Contributor+: $500 @situchan (paid in Upwork)

Eligible for 50% #urgency bonus? N

Upwork job is here.

@situchan can you let me know about a regression test?

situchan commented 10 months ago

We don't need another regression test as bug was caught during staging deploy test by QA team

Christinadobrzyn commented 10 months ago

Awesome thanks @situchan

Payments sent through Upwork based on this payment summary - https://github.com/Expensify/App/issues/32826#issuecomment-1865029133

this can be closed!