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

[HOLD for payment 2023-10-27] [$500] Remove the selected participants from the search results in the split / group chat flow #29836

Closed thienlnam closed 10 months ago

thienlnam 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: Version 1.3.83-1 (1.3.83-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: Slack conversation: https://expensify.slack.com/archives/C05RECHFBEW/p1697553482299739

Action Performed:

Break down in numbered steps

  1. From the global create menu, send a message or request money
  2. Select a bunch of participants and then search for a user that is not in the list

Expected Result:

When you start searching, the selected participants should not show up unless they are part of the search results. When the search text is empty, the selected participants should show up again

Actual Result:

Selected participants are always in the option list

Workaround:

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

Yes, but it's confusing on smaller screens

Platforms:

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

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop https://files.slack.com/files-pri/T047TPA624F-F061DSHBHAS/screenshot_2023-10-17_at_3.55.35_pm.png

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~016fdba16a8b2fba60
  • Upwork Job ID: 1714445993688682496
  • Last Price Increase: 2023-10-18
  • Automatic offers:
    • abdulrahuman5196 | Reviewer | 27519943
    • dukenv0307 | Contributor | 27519945
melvin-bot[bot] commented 11 months ago

Triggered auto assignment to @dylanexpensify (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)

thienlnam commented 11 months ago

Waiting to add external until we confirm this is the desired functionality https://expensify.slack.com/archives/C05RECHFBEW/p1697553482299739

neonbhai commented 11 months ago

Proposal

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

Remove the selected participants from the search results in the split / group chat flow

What is the root cause of that problem?

We always pass selected participants to the options selector here: https://github.com/Expensify/App/blob/8bc86cc83447a0597ed5fcad0a904eaff12fec43/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js#L107-L115 Once selected, the option will always appear. We have to make sure the selected participants react to the searchTerm.

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

We need to:

We will be modifying the behaviour of the this section to filter according to searchTerm: https://github.com/Expensify/App/blob/f626744aa9bdac9c994164af7611a132be2d93c0/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js#L107-L115

We will filter out participants when searchTerm is not empty.

data: _.chain(participants)
        .filter((participant) => searchTerm === '' || participant.searchText.includes(searchTerm))
        .map((participant) => { 
            const isPolicyExpenseChat = lodashGet(participant, 'isPolicyExpenseChat', false);
            return isPolicyExpenseChat ? OptionsListUtils.getPolicyExpenseReportOption(participant) : OptionsListUtils.getParticipantsOption(participant, personalDetails);       
        })
        .value(),

Before mapping the participants, we will filter them by checking the presence of searchTerm in searchText key for participants.

Result:

Screencast from 18-10-23 07:38:24 AM IST.webm

melvin-bot[bot] commented 11 months ago

Job added to Upwork: https://www.upwork.com/jobs/~016fdba16a8b2fba60

melvin-bot[bot] commented 11 months ago

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

thienlnam commented 11 months ago

As a reminder, we still want to show the selected participant if they show up as part of the search results

dukenv0307 commented 11 months ago

Proposal

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

Selected participants are always in the option list, it should only show up it matching the search term, if there's no search term then all should show up.

What is the root cause of that problem?

In here, we're pushing in the list of participants regardless of the search results, so all the participants will show at all time.

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

  1. Replace this by [],, so the participants are not excluded from the search result.
  2. In here, if the search term is empty, we'll push the section of participants normally, otherwise we'll filter the list of participants in the search result newChatOptions and push it in the section instead. That means if there's search term, we'll only show participants that are contained in the search result
  3. In the sections below like this, we'll filter out the participants in data so we don't have a duplicate participant.

What alternative solutions did you explore? (Optional)

In 2, we can simplify by removing this part if the search term is empty, we'll push the section of participants normally, since all the participants are likely already in each of the newChatOptions list, so we'll filter the list of participants in the search result should also work well in the no-search-term case.

An alternative is to fix inside getFilteredOptions to have another section like filteredSelectedOptions which will contains the "selected options that match the search result", we'll not exclude the participants from the search result but push it in another section, with similar logic as above. And use a flag variable to control if we want this behavior when we use filteredSelectedOptions in different places, or we want to keep existing behavior of filtering out the selected options.

abdulrahuman5196 commented 11 months ago

@dukenv0307 's proposal here https://github.com/Expensify/App/issues/29836#issuecomment-1767485951 looks good and works well.

πŸŽ€ πŸ‘€ πŸŽ€ C+ Reviewed

melvin-bot[bot] commented 11 months ago

Current assignee @thienlnam is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

thienlnam commented 11 months ago

Due to the urgency on this - I'm going to take the PR so we can get it merged today, since I'm using part of Dukes solution we can do a partial payment since it appears to be 1am in your time

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.3.87-12 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-10-27. :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:

As a reminder, here are the bonuses/penalties that should be applied for any External 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:

melvin-bot[bot] commented 11 months ago

@danielrvidal, @kevinksullivan, @thienlnam, @abdulrahuman5196 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

abdulrahuman5196 commented 11 months ago

The PR that introduced the bug has been identified. Link to the PR: 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: 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:

Not a regression. Implementation of new expectation.

Determine if we should create a regression test for this bug.

Yes.

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.

1) From the FAB, send a message or split bill 2) On the participants selector, add a couple participants to the group / split 3) Verify that you see them at the top 4) Start searching for a user and verify the selected participants are gone 5) Search for a user that you have selected and verify they show up in the search results 6) Verify that when you search for something, the selected participants disappear unless they are part of the search results

@kevinksullivan

danielrvidal commented 11 months ago

I think @kevinksullivan is off until next week so will get back to it then. I don't have test rail set up unfortunately so couldn't figure out where to put the tests.

dukenv0307 commented 11 months ago

Due to the urgency on this - I'm going to take the PR so we can get it merged today, since I'm using part of Dukes solution we can do a partial payment since it appears to be 1am in your time

@thienlnam can you assign me to this issue for payment purpose, thanks!

melvin-bot[bot] commented 10 months ago

πŸ“£ @abdulrahuman5196 πŸŽ‰ 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 10 months ago

πŸ“£ @dukenv0307 πŸŽ‰ 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 πŸ“–

thienlnam commented 10 months ago

Just a note here @kevinksullivan when you get back, this was a deploy blocker and required an urgent fix so I used part of @dukenv0307's solution and added it myself so that only requires a partial payment (I believe 50% is fair?)

And then full payment for the C+ that reviewed the PR

You may need to adjust the automated offers that were sent out

dukenv0307 commented 10 months ago

I used part of @dukenv0307's solution and added it myself so that only requires a partial payment (I believe 50% is fair?)

I'm good with this, thank you!

kevinksullivan commented 10 months ago

@abdulrahuman5196 can you accept the offer in upwork? Lmk here once you've done so!

kevinksullivan commented 10 months ago

Paid @dukenv0307

abdulrahuman5196 commented 10 months ago

@kevinksullivan accepted the offer

kevinksullivan commented 10 months ago

all set