-
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
Refactor/31312 consolidate getdisplayname methods pt2 #33930
Refactor/31312 consolidate getdisplayname methods pt2 #33930
Conversation
Seems like we have bug on main. Line 4216 in 2d455bf
Otherwise looks good! |
// If we have a number like [email protected] then let's remove @expensify.sms and format it | ||
// so that the option looks cleaner in our UI. | ||
const userLogin = LocalePhoneNumber.formatPhoneNumber(login); | ||
const userDetails = personalDetail ?? allPersonalDetails?.[login]; |
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.
- ?? allPersonalDetails?.[login];
For 2nd case, this is major change. Others are just code refactor, not affecting logic, right?
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.
@situchan could you explain what do you mean by major change? We're always passing personalDetails object that should not be empty, so I removed this check
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.
logic change I mean. Others are just variable re-naming, etc
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid.movAndroid: mWeb Chromemchrome.moviOS: Nativeios.moviOS: mWeb Safarimsafari.movMacOS: Chrome / Safariweb.movMacOS: Desktopdesktop.mov |
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.
Just one minor comment.
src/libs/actions/PersonalDetails.ts
Outdated
*/ | ||
function getDisplayName(login: string, personalDetail: Pick<PersonalDetails, 'firstName' | 'lastName'> | null): string { | ||
function createDisplayName(login: string, personalDetails: Pick<PersonalDetails, 'firstName' | 'lastName'>): string { |
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.
Just curious why we are changing the name. "create" implies to me that we're going to store this somewhere.
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.
@puneetlath I've changed the name bc we're not getting it from Onyx but creating it from given firstName and lastName and then send to API and save in Onyx as optimisticData
I also wanted to differentiate from other methods that are just getting the name from personailDetails from Onyx
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.
Ahhh I see, ok that makes sense.
Looks like typecheck is failing @koko57 |
@puneetlath I fixed the typing should be ok now |
✋ 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 staging by https://github.com/puneetlath in version: 1.4.24-0 🚀
|
🚀 Deployed to production by https://github.com/thienlnam in version: 1.4.24-3 🚀
|
Details
getDisplayNamesStringFromTooltips
- we used it only in one other function to extract the displayNames from the array created by another methodgetDisplayName
tocreateDisplayName
- we're not getting the displayName here from the personalDetailsList, we're creating a new one for the optimistic data; also to avoid confusing it with the other methodsFixed Issues
$ #31312
PROPOSAL: #31312 (comment)
Tests
Offline tests
n/a
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 methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label 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
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop