diff --git a/packages/core/admin/admin/src/components/AuthenticatedApp/index.js b/packages/core/admin/admin/src/components/AuthenticatedApp/index.js index 711f54c3ee..cd3eada9eb 100644 --- a/packages/core/admin/admin/src/components/AuthenticatedApp/index.js +++ b/packages/core/admin/admin/src/components/AuthenticatedApp/index.js @@ -9,12 +9,13 @@ import PluginsInitializer from '../PluginsInitializer'; import RBACProvider from '../RBACProvider'; import { fetchAppInfo, fetchCurrentUserPermissions, fetchStrapiLatestRelease } from './utils/api'; import checkLatestStrapiVersion from './utils/checkLatestStrapiVersion'; +import { getFullName } from '../../utils'; const strapiVersion = packageJSON.version; const AuthenticatedApp = () => { const userInfo = auth.getUserInfo(); - const userName = get(userInfo, 'username') || `${userInfo.firstname} ${userInfo.lastname}`; + const userName = get(userInfo, 'username') || getFullName(userInfo.firstname, userInfo.lastname); const [userDisplayName, setUserDisplayName] = useState(userName); const { showReleaseNotification } = useConfigurations(); const [ diff --git a/packages/core/admin/admin/src/content-manager/components/DynamicTable/TableRows/index.js b/packages/core/admin/admin/src/content-manager/components/DynamicTable/TableRows/index.js index 2fcb1da4c0..9bbf04ebcd 100644 --- a/packages/core/admin/admin/src/content-manager/components/DynamicTable/TableRows/index.js +++ b/packages/core/admin/admin/src/content-manager/components/DynamicTable/TableRows/index.js @@ -13,6 +13,7 @@ import { useHistory } from 'react-router-dom'; import { useIntl } from 'react-intl'; import { usePluginsQueryParams } from '../../../hooks'; import CellContent from '../CellContent'; +import { getFullName } from '../../../../utils'; const TableRows = ({ canCreate, @@ -69,7 +70,7 @@ const TableRows = ({ id: 'app.component.table.select.one-entry', defaultMessage: `Select {target}`, }, - { target: `${data.firstname} ${data.lastname}` } + { target: getFullName(data.firstname, data.lastname) } )} checked={isChecked} onChange={() => { diff --git a/packages/core/admin/admin/src/content-manager/pages/EditView/Informations/index.js b/packages/core/admin/admin/src/content-manager/pages/EditView/Informations/index.js index 489a85c588..2646e2c716 100644 --- a/packages/core/admin/admin/src/content-manager/pages/EditView/Informations/index.js +++ b/packages/core/admin/admin/src/content-manager/pages/EditView/Informations/index.js @@ -8,6 +8,7 @@ import { Flex } from '@strapi/design-system/Flex'; import { Stack } from '@strapi/design-system/Stack'; import { getTrad } from '../../../utils'; import getUnits from './utils/getUnits'; +import { getFullName } from '../../../../utils'; const Informations = () => { const { formatMessage, formatRelativeTime } = useIntl(); @@ -17,7 +18,7 @@ const Informations = () => { const updatedByFirstname = initialData.updatedBy?.firstname || ''; const updatedByLastname = initialData.updatedBy?.lastname || ''; const updatedByUsername = initialData.updatedBy?.username; - const updatedBy = updatedByUsername || `${updatedByFirstname} ${updatedByLastname}`; + const updatedBy = updatedByUsername || getFullName(updatedByFirstname, updatedByLastname); const currentTime = useRef(Date.now()); const timestamp = initialData[updatedAt] ? new Date(initialData[updatedAt]).getTime() diff --git a/packages/core/admin/admin/src/pages/ProfilePage/index.js b/packages/core/admin/admin/src/pages/ProfilePage/index.js index f9c0be15be..1e168ee7ac 100644 --- a/packages/core/admin/admin/src/pages/ProfilePage/index.js +++ b/packages/core/admin/admin/src/pages/ProfilePage/index.js @@ -33,6 +33,7 @@ import Check from '@strapi/icons/Check'; import useLocalesProvider from '../../components/LocalesProvider/useLocalesProvider'; import { fetchUser, putUser } from './utils/api'; import schema from './utils/schema'; +import { getFullName } from '../../utils'; const PasswordInput = styled(TextInput)` ::-ms-reveal { @@ -87,7 +88,7 @@ const ProfilePage = () => { await queryClient.invalidateQueries('user'); auth.setUserInfo(data); - const userDisplayName = data.username || `${data.firstname} ${data.lastname}`; + const userDisplayName = data.username || getFullName(data.firstname, data.lastname); setUserDisplayName(userDisplayName); changeLocale(data.preferedLanguage); @@ -172,7 +173,7 @@ const ProfilePage = () => { return (