-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Allow searching new user in chat finder page #40962
Conversation
@sobitneupane Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Over to you @DylanDylann |
This PR is my son, I will take it |
@nkdengineer lint error |
@DylanDylann Fixed. |
@nkdengineer I give some comments, Let's address it |
@DylanDylann Updated, please help to check again. |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-04-30.at.23.21.39.movAndroid: mWeb ChromeScreen.Recording.2024-04-30.at.23.20.38.moviOS: NativeScreen.Recording.2024-04-30.at.23.21.11.moviOS: mWeb SafariScreen.Recording.2024-04-30.at.23.19.53.movMacOS: Chrome / SafariScreen.Recording.2024-04-30.at.23.17.31.movMacOS: DesktopScreen.Recording.2024-04-30.at.23.18.40.mov |
src/libs/OptionsListUtils.ts
Outdated
}, | ||
}; | ||
userToInvite = createOption([optimisticAccountID], personalDetailsExtended, null, reportActions, { | ||
if (noOptions || noOptionsMatchExactly) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nkdengineer Should we move this check to getUserToInviteOption
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we shouldn't because this check is not the same in filterOptions
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nkdengineer
We can pass one more param like
shouldGetOptionToInvite={noOptions || noOptionsMatchExactly}
similar to another place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DylanDylann Agree, updated to add this param.
src/libs/OptionsListUtils.ts
Outdated
*/ | ||
if (recentReports.length === 0) { | ||
userToInvite = getUserToInviteOption({ | ||
searchValue, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why other params is unnecessary here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unnecessary here because when we get the search option via getSearchOptions
, the other params is default value.
@DylanDylann Please help to check again when you have time. |
src/libs/OptionsListUtils.ts
Outdated
* - The searchValue is a valid email or phone number | ||
* - The searchValue isn't the current personal detail login | ||
* - We can use chronos or the search value is not the chronos email | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please move this to a method doc instead of in the middle of the function?
src/libs/OptionsListUtils.ts
Outdated
(parsedPhoneNumber.possible && Str.isValidE164Phone(LoginUtils.getPhoneNumberWithoutSpecialChars(parsedPhoneNumber.number?.input ?? '')))) && | ||
!optionsToExclude.find((optionToExclude) => 'login' in optionToExclude && optionToExclude.login === PhoneNumber.addSMSDomainIfPhoneNumber(searchValue).toLowerCase()) && | ||
(searchValue !== CONST.EMAIL.CHRONOS || Permissions.canUseChronos(betas)) && | ||
!excludeUnknownUsers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we clean this up a bit more? This condition is hard to read as is. And we could avoid the comment block entirely by creating some variables that are a bit easier to parse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marcaaron I updated, please help to check again.
src/libs/OptionsListUtils.ts
Outdated
const userToInvite = getUserToInviteOption({ | ||
searchValue, | ||
betas, | ||
shouldGetOptionToInvite: recentReports.length === 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Methods usually should not have "canceling" arguments (maybe there are some extreme exceptions). But it looks like we can just set userToInvite
to null
?
It's like having a method called eatFood(doNotEatFood)
(can you tell it's lunch time for me?) 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Methods usually should not have "canceling" arguments (maybe there are some extreme exceptions). But it looks like we can just set userToInvite to null?
Yes we can just set userToInvite
to null
.
Co-authored-by: Marc Glasser <marc.aaron.glasser@gmail.com>
const isValidPhoneNumber = parsedPhoneNumber.possible && Str.isValidE164Phone(LoginUtils.getPhoneNumberWithoutSpecialChars(parsedPhoneNumber.number?.input ?? '')); | ||
const isInOptionToExclude = | ||
optionsToExclude.findIndex((optionToExclude) => 'login' in optionToExclude && optionToExclude.login === PhoneNumber.addSMSDomainIfPhoneNumber(searchValue).toLowerCase()) !== -1; | ||
const isChronosEmail = searchValue === CONST.EMAIL.CHRONOS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks looks soooooo much better ❤️
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to production by https://github.com/marcaaron in version: 1.4.71-6 🚀
|
Details
Allow searching new user in chat finder page
Fixed Issues
$ #40731
PROPOSAL: #40731 (comment)
Tests
Offline tests
Same as above
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
Screen.Recording.2024-04-25.at.13.20.21.mov
iOS: Native
Screen.Recording.2024-04-25.at.13.26.52.mov
iOS: mWeb Safari
Screen.Recording.2024-04-25.at.13.19.49.mov
MacOS: Chrome / Safari
Screen.Recording.2024-04-25.at.13.18.30.mov
MacOS: Desktop
Screen.Recording.2024-04-25.at.13.28.48.mov