Skip to content

[HOLD for payment 2023-08-16] [$1000] Web - New group can't search an email if it's a substring of a selected email #23503

Closed

Description

@kbecciv

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Click FAB => New group
  2. Search an email abcde@gmail.com and select it
  3. Search another email bcde@gmail.com which is a substring of the selected email

Expected Result:

We should be able to search the second email bcde@gmail.com and select it

Actual Result:

We can't search for the second email bcde@gmail.com

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.43-7
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
Notes/Photos/Videos: Any additional supporting documentation

Screen.Recording.2023-07-24.at.5.06.29.PM.mov
Recording.3882.mp4

Expensify/Expensify Issue URL:
Issue reported by: @eh2077
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1690189687158329

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01911c9791a59f71c8
  • Upwork Job ID: 1683657734612238336
  • 2023-07-25
  • Automatic offers:
    • abdulrahuman5196 | Reviewer | 25858891
    • dukenv0307 | Contributor | 25858894

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jul 24, 2023
  2. melvin-bot commented on Jul 24, 2023

    @melvin-bot

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

  3. melvin-bot commented on Jul 24, 2023

    @melvin-bot

    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
  4. kbecciv commented on Jul 24, 2023

    @kbecciv
    Author

    Proposal

    @eh2077

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

    New group can't search an email if it's a substring of a selected email.

    What is the root cause of that problem?

    The root cause of this issue is that we concat logins of selected options to a string filterText and check by !filterText.includes(login) if a login is unselected, which is wrong, see below snippet

    const filterText = _.reduce(selectedOptions, (str, {login}) => `${str} ${login}`, '');
    const recentReportsWithoutSelected = _.filter(filteredRecentReports, ({login}) => !filterText.includes(login));
    const personalDetailsWithoutSelected = _.filter(filteredPersonalDetails, ({login}) => !filterText.includes(login));
    const hasUnselectedUserToInvite = filteredUserToInvite && !filterText.includes(filteredUserToInvite.login);

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

    To fix this issue, we can save logins of selected options to an array selectedLogins and use method !_.contains(selectedLogins, login) to check if a login is unselected.

    To achieve it, we can change

    const filterText = _.reduce(selectedOptions, (str, {login}) => `${str} ${login}`, '');
    const recentReportsWithoutSelected = _.filter(filteredRecentReports, ({login}) => !filterText.includes(login));
    const personalDetailsWithoutSelected = _.filter(filteredPersonalDetails, ({login}) => !filterText.includes(login));
    const hasUnselectedUserToInvite = filteredUserToInvite && !filterText.includes(filteredUserToInvite.login);

    to

    const selectedLogins = _.map(selectedOptions, ({login}) => login);
            const recentReportsWithoutSelected = _.filter(filteredRecentReports, ({login}) => !_.contains(selectedLogins, login));
            const personalDetailsWithoutSelected = _.filter(filteredPersonalDetails, ({login}) => !_.contains(selectedLogins, login));
            const hasUnselectedUserToInvite = filteredUserToInvite && !_.contains(selectedLogins, filteredUserToInvite.login);

    What alternative solutions did you explore? (Optional)

    N/A

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jul 25, 2023
  6. changed the title [-]Web - New group can't search an email if it's a substring of a selected email[/-] [+][$1000] Web - New group can't search an email if it's a substring of a selected email[/+] on Jul 25, 2023
  7. melvin-bot commented on Jul 25, 2023

    @melvin-bot
  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jul 25, 2023
  9. melvin-bot commented on Jul 25, 2023

    @melvin-bot

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

  10. melvin-bot commented on Jul 25, 2023

    @melvin-bot

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

  11. dukenv0307 commented on Jul 25, 2023

    @dukenv0307
    Contributor

    Proposal

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

    New group can't search an email if it's a substring of a selected email.

    What is the root cause of that problem?

    Let's see the current logic on new chat page

    const filterText = _.reduce(selectedOptions, (str, {login}) => `${str} ${login}`, '');
    const recentReportsWithoutSelected = _.filter(filteredRecentReports, ({login}) => !filterText.includes(login));
    const personalDetailsWithoutSelected = _.filter(filteredPersonalDetails, ({login}) => !filterText.includes(login));
    const hasUnselectedUserToInvite = filteredUserToInvite && !filterText.includes(filteredUserToInvite.login);

    We are filtering selected options based on filterText, so in this case abcde@gmail.com.include('bcde@gmail.com') will be true and bcde@gmail.com will not be displaced

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

    when calling getNewChatOptions, we should pass selectedOptions params as 5th param. And then we don't need this logic to filter

    const filterText = _.reduce(selectedOptions, (str, {login}) => `${str} ${login}`, '');
    const recentReportsWithoutSelected = _.filter(filteredRecentReports, ({login}) => !filterText.includes(login));
    const personalDetailsWithoutSelected = _.filter(filteredPersonalDetails, ({login}) => !filterText.includes(login));
    const hasUnselectedUserToInvite = filteredUserToInvite && !filterText.includes(filteredUserToInvite.login);

    This also be the way we did in MoneyRequestParticipantsSplitSelector

    Result

    result.mov

    What alternative solutions did you explore? (Optional)

  12. FabianKoder commented on Jul 25, 2023

    @FabianKoder

    Proposal

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

    New group can't search an email if it's a substring of a selected email.

    What is the root cause of that problem?

    When looking at the existing code:

    const filterText = _.reduce(selectedOptions, (str, {login}) => `${str} ${login}`, '');
    const recentReportsWithoutSelected = _.filter(filteredRecentReports, ({login}) => !filterText.includes(login));
    const personalDetailsWithoutSelected = _.filter(filteredPersonalDetails, ({login}) => !filterText.includes(login));
    const hasUnselectedUserToInvite = filteredUserToInvite && !filterText.includes(filteredUserToInvite.login);

    we can see the problem (!filterText.includes(filteredUserToInvite.login)). This will match every possible combination.

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

    Since filteredUserToInvite as well as selectedOptions both have the unique login property, it is possible to check if at least one element of the selectedOptions has a login identifier thats equal to filteredUserToInvite.login. If that is not the case, we can show the filteredUserToInvite.

    What alternative solutions did you explore? (Optional)

    N/A

  13. 28 remaining items

  14. changed the title [-][$1000] Web - New group can't search an email if it's a substring of a selected email[/-] [+][HOLD for payment 2023-08-16] [$1000] Web - New group can't search an email if it's a substring of a selected email[/+] on Aug 9, 2023
  15. melvin-bot commented on Aug 9, 2023

    @melvin-bot

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

  16. melvin-bot commented on Aug 9, 2023

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.51-2 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 2023-08-16. 🎊

    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:

    As a reminder, here are the bonuses/penalties that should be applied for any External issue:

    • Merged PR within 3 business days of assignment - 50% bonus
    • Merged PR more than 9 business days after assignment - 50% penalty
  17. melvin-bot commented on Aug 9, 2023

    @melvin-bot
  18. abdulrahuman5196 commented on Aug 12, 2023

    @abdulrahuman5196
    Contributor

    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:

    #7986 (comment)

    Determine if we should create a regression test for this bug.
    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.

    No. Regression test won't be beneficial for this minor test case.

  19. sophiepintoraetz commented on Aug 16, 2023

    @sophiepintoraetz
    Contributor

    Reconfirming that because there were no regressions and the PR review was held up on an Expensifier, and there were no major revisions suggested on the PR, I think this issue qualifies for an urgency bonus. This makes payments:

    Payouts due:

    Issue Reporter: $250 @eh2077/Eric Han
    Contributor: $1500 @dukenv0307
    Contributor+: $1500 @abdulrahuman5196 (via NewDot manual request)

    Eligible for 50% #urgency bonus? Y

  20. sophiepintoraetz commented on Aug 16, 2023

    @sophiepintoraetz
    Contributor

    Offer sent to bug reporter

  21. eh2077 commented on Aug 17, 2023

    @eh2077
    Contributor

    @sophiepintoraetz Accepted the offer thanks!

  22. eh2077 commented on Aug 22, 2023

    @eh2077
    Contributor

    Bump @sophiepintoraetz Can you kindly approve the payment for report bonus in Upwork? Thank you!

  23. abdulrahuman5196 commented on Aug 23, 2023

    @abdulrahuman5196
    Contributor

    @sophiepintoraetz For me urgency bonus was not applied -
    Screenshot 2023-08-23 at 9 34 09 PM

  24. sophiepintoraetz commented on Aug 24, 2023

    @sophiepintoraetz
    Contributor

    @abdulrahuman5196 - apologies, I thought you were being paid via NewDot - you actually haven't been paid so let me do that now.

  25. abdulrahuman5196 commented on Aug 25, 2023

    @abdulrahuman5196
    Contributor

    No worries. Thank you @sophiepintoraetz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorWeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions