-
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
fix: some member appear as Hidden #53540
base: main
Are you sure you want to change the base?
Conversation
@dukenv0307 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] |
src/libs/PersonalDetailsUtils.ts
Outdated
@@ -75,7 +75,7 @@ function getDisplayNameOrDefault(passedPersonalDetails?: Partial<PersonalDetails | |||
if (displayName) { | |||
return displayName; | |||
} | |||
return defaultValue || (shouldFallbackToHidden ? hiddenTranslation : ''); | |||
return defaultValue || (passedPersonalDetails?.login ?? (shouldFallbackToHidden ? hiddenTranslation : '')); |
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.
Here's my suggestion:
function getDisplayNameOrDefault(passedPersonalDetails?: Partial<PersonalDetails> | null, defaultValue = '', shouldFallbackToHidden = true, shouldAddCurrentUserPostfix = false): string {
let displayName = passedPersonalDetails?.displayName ?? '';
const login = passedPersonalDetails?.login;
// If the displayName starts with the merged account prefix, remove it.
if (regexMergedAccount.test(displayName)) {
// Remove the merged account prefix from the displayName.
displayName = displayName.replace(CONST.REGEX.MERGED_ACCOUNT_PREFIX, '');
}
// If the displayName is not set by the user, the backend sets the diplayName same as the login so
// we need to remove the sms domain from the displayName if it is an sms login.
if (displayName === login && Str.isSMSLogin(login)) {
displayName = Str.removeSMSDomain(displayName);
}
if (shouldAddCurrentUserPostfix && !!displayName) {
displayName = `${displayName} (${youTranslation})`;
}
if (passedPersonalDetails?.accountID === CONST.ACCOUNT_ID.CONCIERGE) {
displayName = CONST.CONCIERGE_DISPLAY_NAME;
}
if (displayName) {
return displayName;
}
if(defaultValue){
return defaultValue;
}
if(login){
if(Str.isSMSLogin(login)) {
return Str.removeSMSDomain(login);
}
return login;
}
return shouldFallbackToHidden ? hiddenTranslation : '';
}
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 @dukenv0307, i updated
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-12-07.at.10.06.51.moviOS: NativeScreen.Recording.2024-12-07.at.10.14.09.moviOS: mWeb SafariScreen.Recording.2024-12-07.at.09.54.47.movMacOS: Chrome / SafariScreen.Recording.2024-12-07.at.09.53.10.movMacOS: DesktopScreen.Recording.2024-12-07.at.10.14.40.mov |
Explanation of Change
Fixed Issues
$ #51934
PROPOSAL: #51934 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)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
Screen.Recording.2024-12-05.at.15.21.34.mov
Android: mWeb Chrome
Screen.Recording.2024-12-05.at.15.49.34.mov
iOS: Native
Screen.Recording.2024-12-05.at.17.28.49.mov
iOS: mWeb Safari
Screen.Recording.2024-12-05.at.15.49.34.mov
MacOS: Chrome / Safari
Screen.Recording.2024-12-04.at.17.36.43.mp4
MacOS: Desktop
Screen.Recording.2024-12-05.at.17.32.48.mp4