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-06-20] [$250] Workflow - Custom name user searched with email id shows no results found #42576

Closed
4 of 6 tasks
izarutskaya opened this issue May 24, 2024 · 24 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 External Added to denote the issue can be worked on by a contributor

Comments

@izarutskaya
Copy link

izarutskaya commented May 24, 2024

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.75-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/4572920
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team

Action Performed:

Pre-condition: login with admin account of collect workspace with members added with username

  1. Go to https://staging.new.expensify.com/
  2. Tap profile -- workspaces -- workspace
  3. Tap more features
  4. Enable workflows
  5. Tap workflow --- approver
  6. Search with email id
  7. Search same user with user name

Expected Result:

User with custom name searched with email id must show results.

Actual Result:

User with custom name searched with email id shows no results found but same user searched with user name results are shown.

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

Bug6489900_1716498799411.Screenrecorder-2024-05-24-02-31-07-797_compress_1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0114334b097551357e
  • Upwork Job ID: 1795461959369322496
  • Last Price Increase: 2024-05-28
  • Automatic offers:
    • eh2077 | Reviewer | 102530569
    • nkdengineer | Contributor | 102530574
Issue OwnerCurrent Issue Owner: @abekkala
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 24, 2024
Copy link

melvin-bot bot commented May 24, 2024

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

@izarutskaya
Copy link
Author

We think this issue might be related to the #collect project.

@cretadn22
Copy link
Contributor

Proposal

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

Can't search user by email

What is the root cause of that problem?

This is the logic to filter the options on the approver page

const filteredOptions = [...formattedApprover, ...formattedPolicyEmployeeList].filter((option) => {
const searchValue = OptionsListUtils.getSearchValueForPhoneOrEmail(searchTerm);
return !!option.text?.toLowerCase().includes(searchValue) || !!option.login?.toLowerCase().includes(searchValue);
});

We only check if the text or login field contains the searchValue

This is the option object

photo12

The bug stems from the fact that the text or login fields aren't the email fields

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

const filteredOptions = [...formattedApprover, ...formattedPolicyEmployeeList].filter((option) => {
const searchValue = OptionsListUtils.getSearchValueForPhoneOrEmail(searchTerm);
return !!option.text?.toLowerCase().includes(searchValue) || !!option.login?.toLowerCase().includes(searchValue);
});

I propose we also include a condition to verify if the 'alternateText' field contains the searchValue

return !!option.text?.toLowerCase().includes(searchValue) || !!option.login?.toLowerCase().includes(searchValue) || !!option.alternativeText?.toLowerCase().includes(searchValue);

Optional: We might consider removing the check for the login field

What alternative solutions did you explore? (Optional)

@nkdengineer
Copy link
Contributor

Proposal

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

User with custom name searched with email id shows no results found but same user searched with user name results are shown.

What is the root cause of that problem?

The formattedMember doesn't contain the login field

So when we filter the option with custom display name here, it doesn't match

return !!option.text?.toLowerCase().includes(searchValue) || !!option.login?.toLowerCase().includes(searchValue);

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

I think we should filter out the option when we get formattedPolicyEmployeeList and formattedApprover because if we only check text and login or alternateText, it doesn't work when we search for phone number account.

To filter out the member option in here, we can do the same way as we do in RoomMembersPage here. We can add the filter after this block like this.

const searchValue = OptionsListUtils.getSearchValueForPhoneOrEmail(searchTerm);
if (searchValue.trim()) {
    let memberDetails = '';
    if (details.login) {
        memberDetails += ` ${details.login.toLowerCase()}`;
    }
    if (details.firstName) {
        memberDetails += ` ${details.firstName.toLowerCase()}`;
    }
    if (details.lastName) {
        memberDetails += ` ${details.lastName.toLowerCase()}`;
    }
    if (details.displayName) {
        memberDetails += ` ${PersonalDetailsUtils.getDisplayNameOrDefault(details).toLowerCase()}`;
    }
    if (details.phoneNumber) {
        memberDetails += ` ${details.phoneNumber.toLowerCase()}`;
    }

    if (!OptionsListUtils.isSearchStringMatch(searchValue.trim(), memberDetails)) {
        return;
    }
}

const [formattedPolicyEmployeeList, formattedApprover] = useMemo(() => {

And then we don't need to filter options here, we only need to return [...formattedApprover, ...formattedPolicyEmployeeList]

if (searchTerm !== '') {
    return [
        {
            title: undefined,
            data: [...formattedApprover, ...formattedPolicyEmployeeList],
            shouldShow: true,
        },
    ];
}

const filteredOptions = [...formattedApprover, ...formattedPolicyEmployeeList].filter((option) => {

What alternative solutions did you explore? (Optional)

NA

@cretadn22
Copy link
Contributor

image2

it doesn't work when we search for phone number account.

@nkdengineer My proposal works well for phone number

@nkdengineer
Copy link
Contributor

If you search the phone number without the space, it doesn't work. User should be able to search phone number without space.

@melvin-bot melvin-bot bot added the Overdue label May 27, 2024
Copy link

melvin-bot bot commented May 27, 2024

@abekkala Whoops! This issue is 2 days overdue. Let's get this updated quick!

@abekkala abekkala added the External Added to denote the issue can be worked on by a contributor label May 28, 2024
Copy link

melvin-bot bot commented May 28, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0114334b097551357e

@melvin-bot melvin-bot bot changed the title Workflow - Custom name user searched with email id shows no results found [$250] Workflow - Custom name user searched with email id shows no results found May 28, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label May 28, 2024
Copy link

melvin-bot bot commented May 28, 2024

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

@eh2077
Copy link
Contributor

eh2077 commented May 29, 2024

Thank you for your proposals! The root cause of this issue is clear.

@nkdengineer explored a bit more on the solution - they mentioned we have similar use case in RoomMembersPage. But their solution can be improved - we can do some refactoring to follow DRY principle, see

const participantNames = getParticipantNames(participantsList);
if (searchValue && !isSearchStringMatch(searchValue, searchText, participantNames, isChatRoom)) {
return;

getParticipantNames and isSearchStringMatch.


That said, I think we can go with @nkdengineer 's proposal. Coding details can be discussed in PR.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented May 29, 2024

Triggered auto assignment to @thienlnam, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@thienlnam
Copy link
Contributor

Thanks! It looks like @nkdengineer has a significant amount of pending PRs going on. So in line with this please continue with your ongoing PRs.

@eh2077 Could you work with one of the other contributors to get their proposal to a state that you can approve?

@nkdengineer
Copy link
Contributor

nkdengineer commented May 29, 2024

@thienlnam All of my PRs have almost no pending action from me. A few PRs have just been reviewed but it's quite late in my timezone, I'll update them tomorrow morning. With this issue I can raise the PR tomorrow morning and work on the PR without delay if I am assigned.

@thienlnam
Copy link
Contributor

Let us know once you've updated all your PRs and then we can continue here otherwise we'll re-assign it to someone else that has more availability. You're doing great, but we want to ensure nothing gets blocked

@nkdengineer
Copy link
Contributor

@thienlnam I've updated my PRs. I'm free to work on this now. Can you please assign me and then I can raise the PR soon? Thanks.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label May 30, 2024
Copy link

melvin-bot bot commented May 30, 2024

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

Copy link

melvin-bot bot commented May 30, 2024

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

@nkdengineer
Copy link
Contributor

@eh2077 this PR is ready for preview

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jun 13, 2024
@melvin-bot melvin-bot bot changed the title [$250] Workflow - Custom name user searched with email id shows no results found [HOLD for payment 2024-06-20] [$250] Workflow - Custom name user searched with email id shows no results found Jun 13, 2024
Copy link

melvin-bot bot commented Jun 13, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 13, 2024
Copy link

melvin-bot bot commented Jun 13, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.82-4 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-06-20. 🎊

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

Copy link

melvin-bot bot commented Jun 13, 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:

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

@eh2077
Copy link
Contributor

eh2077 commented Jun 14, 2024

Checklist

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 19, 2024
@abekkala
Copy link
Contributor

PAYMENT SUMMARY FOR JUNE 20

@abekkala
Copy link
Contributor

@nkdengineer payment sent and contract ended - thank you! 🎉

@eh2077 payment sent and contract ended - thank you! 🎉

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 External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Archived in project
Development

No branches or pull requests

6 participants