Skip to content

[Hold for payment on Thurs 26th Aug] User's Profile is shown in searches when email/phone is entered #4325

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

Closed
aman-atg opened this issue Jul 30, 2021 · 25 comments
Assignees
Labels
Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@aman-atg
Copy link
Contributor

aman-atg commented Jul 30, 2021

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


Action Performed:

  1. Login to new expensify
  2. Search for your email/phone
  3. Your own profile will appear as an option

Expected Result:

Current User shouldn't appear as an option

image
image

Actual Result:

bug.mp4

image

Workaround:

None.

Platform:

Where is this issue occurring?

  • Web
  • iOS
  • Android
  • Desktop App
  • Mobile Web

Expensify/Expensify Issue URL: N/A
Upwork job link https://www.upwork.com/jobs/~015c092db274787ca2

View all open jobs on Upwork

@aman-atg aman-atg added AutoAssignerTriage Auto assign issues for triage to an available triage team member Daily KSv2 labels Jul 30, 2021
@MelvinBot
Copy link

Triggered auto assignment to @bfitzexpensify (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

@MelvinBot MelvinBot removed the AutoAssignerTriage Auto assign issues for triage to an available triage team member label Jul 30, 2021
@aman-atg
Copy link
Contributor Author

aman-atg commented Jul 30, 2021

Proposal

Explaination

It's happening because we're not checking if the searchValue is User's one of the logins or not

Solution

    // eslint-disable-next-line no-use-before-define
    const isInvalidLogin = isCurrentUser({login: searchValue});
    let userToInvite = null;
    if (searchValue && !isInvalidLogin
  • Integrating the above code after line 464 will fix the issue
    let userToInvite = null;
    if (searchValue
    && recentReportOptions.length === 0
    && personalDetailsOptions.length === 0
    && _.every(selectedOptions, option => option.login !== searchValue)
    && ((Str.isValidEmail(searchValue) && !Str.isDomainEmail(searchValue)) || Str.isValidPhone(searchValue))
    && (searchValue !== CONST.EMAIL.CHRONOS || Permissions.canUseChronos(betas))
    ) {

@rdjuric
Copy link
Contributor

rdjuric commented Jul 31, 2021

Looks similar to #4011

@aman-atg
Copy link
Contributor Author

aman-atg commented Jul 31, 2021

@rdjuric It isn't.

We're already trying to exclude the User from the OptionList as you can see below

// Always exclude already selected options and the currently logged in user
const loginOptionsToExclude = [...selectedOptions, {login: currentUserLogin}];

But that approach fails when user directly searches for it's login. Then we're making API calls which are failing because it's an unexpected scenario.

@MelvinBot
Copy link

@bfitzexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@bfitzexpensify
Copy link
Contributor

Reproduced (note: your own profile only appears once you've typed the full phone number/email address)

@MelvinBot MelvinBot removed the Overdue label Aug 3, 2021
@bfitzexpensify bfitzexpensify removed their assignment Aug 3, 2021
@MelvinBot
Copy link

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

@stitesExpensify stitesExpensify added the External Added to denote the issue can be worked on by a contributor label Aug 6, 2021
@MelvinBot
Copy link

Triggered auto assignment to @michaelhaxhiu (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@stitesExpensify
Copy link
Contributor

Hi @michaelhaxhiu can we hire @aman-atg to fix this please?

@aman-atg

This comment has been minimized.

@MelvinBot
Copy link

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

@michaelhaxhiu
Copy link
Contributor

Sorry for the wait. Posted the job here - https://www.upwork.com/jobs/~015c092db274787ca2

@aman-atg can you propose to handle the job on Upwork and then we can hire you?

@MelvinBot MelvinBot removed the Overdue label Aug 10, 2021
@michaelhaxhiu
Copy link
Contributor

Also, this issue exists across all platforms right?

I can't reproduce this on iOS actually. Can you please clarify the affected platforms before beginning work @aman-atg?

@aman-atg
Copy link
Contributor Author

aman-atg commented Aug 10, 2021

I tested this on android, web and android web and the searching logic is same for all so it should also happen on iOS/Desktop.
I can't test on those two, so I can't confirm.

@michaelhaxhiu
Copy link
Contributor

Please ⏸️ for a moment. cc @mallenexpensify

@mallenexpensify mallenexpensify changed the title User's Profile is shown in searches when email/phone is entered [HOLD] User's Profile is shown in searches when email/phone is entered Aug 10, 2021
@mallenexpensify mallenexpensify added Weekly KSv2 Exported and removed Daily KSv2 labels Aug 10, 2021
@MelvinBot MelvinBot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 13, 2021
@MelvinBot
Copy link

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

@mallenexpensify mallenexpensify changed the title [HOLD] User's Profile is shown in searches when email/phone is entered User's Profile is shown in searches when email/phone is entered Aug 13, 2021
@mallenexpensify
Copy link
Contributor

Taking off HOLD, @Julesssss can you review @aman-atg proposal please?

@Julesssss
Copy link
Contributor

Julesssss commented Aug 13, 2021

Hi @aman-atg the solution seems correct, but I think instead we should add that condition inline to match the rest of the logic:

if (searchValue 
     && recentReportOptions.length === 0 
     && personalDetailsOptions.length === 0 
     && !isCurrentUser({login: searchValue})
     ...

@mallenexpensify please go ahead and hire @aman-atg

@aman-atg
Copy link
Contributor Author

Thanks @Julesssss.
Will follow the above approach while submitting the PR.

@Christinadobrzyn
Copy link
Contributor

Hey @mallenexpensify This issue has the Help Wanted label, I believe it can be removed but can you confirm and remove it if that's true?

@mallenexpensify mallenexpensify removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 17, 2021
@mallenexpensify
Copy link
Contributor

Yes, thank for the 👀 and ping @Christinadobrzyn , label removed

@Julesssss Julesssss changed the title User's Profile is shown in searches when email/phone is entered [Hold for payment on Thurs 26th Aug] User's Profile is shown in searches when email/phone is entered Aug 20, 2021
@MelvinBot

This comment has been minimized.

@mallenexpensify
Copy link
Contributor

chill Melvin...

@MelvinBot MelvinBot removed the Overdue label Aug 25, 2021
@mallenexpensify
Copy link
Contributor

Just deployed to production today but paying because it's been 17 days since merge (and our policy at the time was to pay a week after merge). Bonus added for reporting issue.

@mallenexpensify
Copy link
Contributor

Forgot to close last week...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

9 participants