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.48k stars 2.84k forks source link

Search - "is not a valid email address" when starting a DM with phone user via Search #51137

Open IuliiaHerets opened 17 hours ago

IuliiaHerets commented 17 hours 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: 9.0.51-1 Reproducible in staging?: Y Reproducible in production?: N Email or phone of affected tester (no customers): applausetester+kh081006@applause.expensifail.com Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Click on the search icon on any report.
  3. Enter a valid phone number.
  4. Click on the search result to initiate a DM with the phone number.

Expected Result:

No error should show up because user should be able to initiate a DM with phone number user via Search.

Actual Result:

App shows "is not a valid email address" when starting a DM with phone user via Search. Note that user can initiate DM with the same phone number via Start chat in FAB.

Workaround:

Unknown

Platforms:

Screenshots/Videos

https://github.com/user-attachments/assets/53cfffc4-4025-4d30-9611-aaad59c6c9de

View all open jobs on GitHub

melvin-bot[bot] commented 17 hours ago

Triggered auto assignment to @jasperhuangg (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

github-actions[bot] commented 17 hours ago

:wave: 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.
melvin-bot[bot] commented 17 hours ago

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

melvin-bot[bot] commented 17 hours ago

💬 A slack conversation has been started in #expensify-open-source

truph01 commented 4 hours ago

Edited by proposal-police: This proposal was edited at 2024-10-21 06:21:30 UTC.

Proposal

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

App shows "is not a valid email address" when starting a DM with phone user via Search. Note that user can initiate DM with the same phone number via Start chat in FAB.

What is the root cause of that problem?

https://github.com/Expensify/App/blob/893ef36651076952e1d5d71bf34752b5a9bbf644/src/libs/OptionsListUtils.ts#L2534

we already have logic to format the search value string if it is phone number:

https://github.com/Expensify/App/blob/893ef36651076952e1d5d71bf34752b5a9bbf644/src/libs/OptionsListUtils.ts#L2475-L2476

but we don't do it in Search:

https://github.com/Expensify/App/blob/893ef36651076952e1d5d71bf34752b5a9bbf644/src/components/Search/SearchRouter/SearchRouter.tsx#L125-L131

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

+      const parsedPhoneNumber = PhoneNumber.parsePhoneNumber(LoginUtils.appendCountryCode(Str.removeSMSDomain(debouncedInputValue)));
+      const searchValue = parsedPhoneNumber.possible && parsedPhoneNumber.number?.e164 ? parsedPhoneNumber.number.e164 : debouncedInputValue;
        const userToInvite = OptionsListUtils.pickUserToInvite({
            canInviteUser: true,
            recentReports: newOptions.recentReports,
            personalDetails: newOptions.personalDetails,
+          searchValue: searchValue,
            optionsToExclude: [{login: CONST.EMAIL.NOTIFICATIONS}],
        });

What alternative solutions did you explore? (Optional)