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-03-07] [LOW] [P2P] [$500] IOU-Add a contact to request money and tap back button, contact added to split. #32912

Closed
5 of 6 tasks
izarutskaya opened this issue Dec 12, 2023 · 91 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 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@izarutskaya
Copy link

izarutskaya commented Dec 12, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 1.4.11
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 https://staging.new.expensify.com/
  2. Tap fab
  3. Tap request money
  4. Enter an amount
  5. Tap next
  6. Select a contact
  7. Tap app's back button

Expected Result:

When add a contact to request money and tap back button, contact must not be added to split.

Actual Result:

When add a contact to request money and tap back button, contact added to split.

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

Bug6309952_1702352257190.add_to_split.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01ce8011451da4f3dc
  • Upwork Job ID: 1734532115895476224
  • Last Price Increase: 2023-12-12
  • Automatic offers:
    • bernhardoj | Contributor | 28044286
    • akinwale | Contributor | 0
@izarutskaya izarutskaya added DeployBlockerCash This issue or pull request should block deployment 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 12, 2023
@melvin-bot melvin-bot bot changed the title IOU-Add a contact to request money and tap back button, contact added to split. [$500] IOU-Add a contact to request money and tap back button, contact added to split. Dec 12, 2023
Copy link

melvin-bot bot commented Dec 12, 2023

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

Copy link

melvin-bot bot commented Dec 12, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01ce8011451da4f3dc

Copy link

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

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

melvin-bot bot commented Dec 12, 2023

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

@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Dec 12, 2023
Copy link
Contributor

👋 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.

Copy link

melvin-bot bot commented Dec 12, 2023

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

@shubham1206agra
Copy link
Contributor

We are not clearing participants list when coming back

/**
 * @param {String} transactionID
 * @param {Object[]} participants
 */
function setMoneyRequestParticipants_temporaryForRefactor(transactionID, participants) {
    Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {participants});
}

There are some problems with the current logic of participants page
I will get back to this after some time. There are some other problems too

@Julesssss
Copy link
Contributor

Please prioritise this once you finish the C+ reviews, thank you!

@dukenv0307
Copy link
Contributor

dukenv0307 commented Dec 12, 2023

Proposal

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

When add a contact to request money and tap back button, contact added to split.

What is the root cause of that problem?

We're not clearing the participants list when coming back and the request is a request (not a split).

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

Clearing the participants list when coming back and the request is a request (not a split). In the split case we should keep the participants because the user expects to unselect or select more participants.

What alternative solutions did you explore? (Optional)

There's also a bug where when clicking "Split" in the participants list when 1 participant is already selected for the split, it only adds that participant to the Split (we need to add the current user as well). We can fix that by appending the participants properly

@shubham1206agra
Copy link
Contributor

@dukenv0307 Do you have a solution right now?
If so, @Julesssss please assign @dukenv0307

@bernhardoj
Copy link
Contributor

bernhardoj commented Dec 12, 2023

Proposal

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

Pressing a participant and then go back will show the participant as selected and there is a Add to split button.

What is the root cause of that problem?

This issue was previously fixed in #28751 by adding isSplitRequest property to the IOU.

When we press a participant, it will be added to the transaction participants data. If the participants (this.props.selectedOptions) data is not empty, the "Add to split" button will be shown.

const shouldShowFooter =
!this.props.isReadOnly && (this.props.shouldShowConfirmButton || this.props.footerContent) && !(this.props.canSelectMultipleOptions && _.isEmpty(this.props.selectedOptions));

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

Add back some of the solutions from #28751. Based on the discussion, we want to use a route-based solution. To achieve that, every time we add a participant as the split participant, update the iouType route params to SPLIT, otherwise update it to REQUEST. But if we change the money request tab (manual, scan, distance), then we need to reset the iouType because the participant is also cleared.

If the iouType is SPLIT, then we change the title to Split.

Also, if we press "Add to split" button, then we should pass iouType SPLIT to the confirmation page. But if we press the participant directly, then we should pass iouType as REQUEST to the confirmation page.

Details
  1. In MoneyTemporaryForRefactorRequestParticipantsSelector,
    a. for onParticipantsAdded pass a second parameter with either true/false value to indicate whether it's a split participant or not.

Pass false here (not a split)

const addSingleParticipant = (option) => {
onParticipantsAdded([
{
..._.pick(option, 'accountID', 'login', 'isPolicyExpenseChat', 'reportID', 'searchText'),
selected: true,
},
]);

Pass newSelectedOptions.length !== 0 here (a split if we select >= 1 user)

b. for onFinish, pass the correct iouType to navigate to.
Pass CONST.IOU.TYPE.REQUEST here

Pass CONST.IOU.TYPE.SPLIT here for the "Add to split" button


onFinish will call goToNextStep in IOURequestStepParticipants.

  1. In IOURequestStepParticipants:
    a. addParticipant accepts a new 2nd parameter called isSplit and updates the route params as below
    const addParticipant = useCallback(
    (val) => {
    IOU.setMoneyRequestParticipants_temporaryForRefactor(transactionID, val);
let newIouType;
if (isSplit && iouType !== CONST.IOU.TYPE.SPLIT) {
    newIouType = CONST.IOU.TYPE.SPLIT;
} else if (!isSplit && iouType !== CONST.IOU.TYPE.REQUEST) {
    newIouType = CONST.IOU.TYPE.REQUEST;
}

if (newIouType) {
    // update the participant page iouType params
    Navigation.setParams({iouType: newIouType});
    const routes = navigation.getState().routes;
    routes.forEach((route) => {
        if (route.name === SCREENS.MONEY_REQUEST.CREATE) {
            // update the money request first (selector/create) page iouType params
            Navigation.setParams({iouType: newIouType}, route.key);
        }
    });
}

b. goToNextStep accepts a new parameter called nextStepIOUType and removes the current nextStepIOUType. The nextStepIOUType param is coming from the onFinish that we updated before on the 1st step.

const goToNextStep = useCallback(() => {
const nextStepIOUType = numberOfParticipants.current === 1 ? iouType : CONST.IOU.TYPE.SPLIT;
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(nextStepIOUType, transactionID, selectedReportID.current || reportID));
}, [iouType, transactionID, reportID]);

c. Update the headerTitle to show Split if it's a split request. This is the same logic as in IOURequestStepConfirmation

const isSplitRequest = iouType === CONST.IOU.TYPE.SPLIT;
const headerTitle = isSplitRequest ? translate('iou.split') : translate(TransactionUtils.getHeaderTitleTranslationKey(transaction));
  1. Last, reset the iouType back to REQUEST if the money request tab changes in resetIOUTypeIfChanged.
    const resetIOUTypeIfChanged = useCallback(
    (newIouType) => {
    if (newIouType === previousIOURequestType) {
    return;
    }
    IOU.startMoneyRequest_temporaryForRefactor(reportID, isFromGlobalCreate, newIouType);
    transactionRequestType.current = newIouType;
    },
    [previousIOURequestType, reportID, isFromGlobalCreate],
    );
if (iouType !== CONST.IOU.TYPE.REQUEST) {
    const routes = navigation.getState().routes;
    routes.forEach((route) => {
        if (route.name === SCREENS.MONEY_REQUEST.CREATE) {
            Navigation.setParams({iouType: CONST.IOU.TYPE.REQUEST}, route.key);
        }
    });
}

@shubham1206agra
Copy link
Contributor

Can you post the video @bernhardoj?

@dukenv0307
Copy link
Contributor

@dukenv0307 Do you have a solution right now?
If so, @Julesssss please assign @dukenv0307

@shubham1206agra yes, I can work on this right now

@bernhardoj
Copy link
Contributor

Added the video

@dukenv0307
Copy link
Contributor

@shubham1206agra I think the proposal by @bernhardoj is basically what I proposed at a high level (but with added code changes)

@dukenv0307
Copy link
Contributor

@Julesssss Can you assign @dukenv0307 here?

Meanwhile I can make a head start on this to make sure it's merged quickly 👍

Copy link

melvin-bot bot commented Feb 26, 2024

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

@MitchExpensify
Copy link
Contributor

@akinwale has volunteered to take over here 🙇

@MitchExpensify
Copy link
Contributor

@youssef-lr Are we ready to merge here?

@youssef-lr
Copy link
Contributor

Reviewing now!

@youssef-lr
Copy link
Contributor

Code LGTM, but I found a bug.

Copy link

melvin-bot bot commented Feb 29, 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.

Edit: not a regression

Copy link

melvin-bot bot commented Feb 29, 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 Daily KSv2 labels Feb 29, 2024
@melvin-bot melvin-bot bot changed the title [$500] IOU-Add a contact to request money and tap back button, contact added to split. [HOLD for payment 2024-03-07] [$500] IOU-Add a contact to request money and tap back button, contact added to split. Feb 29, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 29, 2024
Copy link

melvin-bot bot commented Feb 29, 2024

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

Copy link

melvin-bot bot commented Feb 29, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.45-6 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-03-07. 🎊

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

Copy link

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

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

@MitchExpensify
Copy link
Contributor

Reminder set to pay

@arielgreen arielgreen changed the title [HOLD for payment 2024-03-07] [$500] IOU-Add a contact to request money and tap back button, contact added to split. [HOLD for payment 2024-03-07] [LOW] [P2P] [$500] IOU-Add a contact to request money and tap back button, contact added to split. Mar 4, 2024
@tgolen
Copy link
Contributor

tgolen commented Mar 7, 2024

@MitchExpensify Can you please ensure that @situchan gets paid for a C+ review of #32948

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Mar 7, 2024
@MitchExpensify
Copy link
Contributor

MitchExpensify commented Mar 9, 2024

Payment summary:

C+: $500 @bernhardoj (Upwork)
C: $500 @akinwale (Upwork)

Paid and contracts ended

@MitchExpensify
Copy link
Contributor

I mistook my payment to Bernhard for a payment to Situ - Very sorry for that slip up @situchan. To correct it I have sent you an offer here https://www.upwork.com/nx/wm/offer/101471671

@situchan
Copy link
Contributor

Accepted thanks

@MitchExpensify
Copy link
Contributor

Paid and contract ended, thanks!

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 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests