-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Update Workspace auto naming to include using First Name over the username of a public email #44109
Changes from 4 commits
e50bab6
e91e472
7f2896c
10cdf40
6a403d3
fee8c12
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -41,6 +41,7 @@ import * as ErrorUtils from '@libs/ErrorUtils'; | |||||
import getIsNarrowLayout from '@libs/getIsNarrowLayout'; | ||||||
import Log from '@libs/Log'; | ||||||
import * as NumberUtils from '@libs/NumberUtils'; | ||||||
import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; | ||||||
import * as PhoneNumber from '@libs/PhoneNumber'; | ||||||
import * as PolicyUtils from '@libs/PolicyUtils'; | ||||||
import {navigateWhenEnableFeature} from '@libs/PolicyUtils'; | ||||||
|
@@ -1355,11 +1356,17 @@ function generateDefaultWorkspaceName(email = ''): string { | |||||
} | ||||||
const username = emailParts[0]; | ||||||
const domain = emailParts[1]; | ||||||
const userDetails = PersonalDetailsUtils.getPersonalDetailByEmail(sessionEmail); | ||||||
const displayName = `${userDetails?.firstName ?? ''}${userDetails?.lastName ? ` ${userDetails.lastName}` : ''}`; | ||||||
|
||||||
if (PUBLIC_DOMAINS.some((publicDomain) => publicDomain === domain.toLowerCase())) { | ||||||
if (!PUBLIC_DOMAINS.some((publicDomain) => publicDomain === domain.toLowerCase())) { | ||||||
defaultWorkspaceName = `${Str.UCFirst(domain.split('.')[0])}'s Workspace`; | ||||||
} else if (displayName !== '') { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
defaultWorkspaceName = `${Str.UCFirst(displayName)}'s Workspace`; | ||||||
} else if (PUBLIC_DOMAINS.some((publicDomain) => publicDomain === domain.toLowerCase())) { | ||||||
defaultWorkspaceName = `${Str.UCFirst(username)}'s Workspace`; | ||||||
} else { | ||||||
defaultWorkspaceName = `${Str.UCFirst(domain.split('.')[0])}'s Workspace`; | ||||||
defaultWorkspaceName = userDetails?.phoneNumber ?? ''; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually is there any possible case where we use a phone number? there'll always be an email associated with the account. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when you login via a new account with phone number, i guess at that time this case is used, I will confirm if that hypothesis is true in sometime There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets keep this code, The comment does say that we should have a phone number case so better to keep :) |
||||||
} | ||||||
|
||||||
if (`@${domain.toLowerCase()}` === CONST.SMS.DOMAIN) { | ||||||
|
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.
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.
Are you sure that there is a
displayName
property ? and it would not add extra space if we do not have the last name?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.
Yes, there is 😄
We can trim it if that's the case!
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.
umm, makes sense, i will update this PR by EOD.