diff --git a/client/lib/getUserEmailAddress.ts b/client/lib/getUserEmailAddress.ts index 4c2ecc7ab6d1..fea5cce1563e 100644 --- a/client/lib/getUserEmailAddress.ts +++ b/client/lib/getUserEmailAddress.ts @@ -1,4 +1,4 @@ -import type { IUser, IUserEmail } from '../../definition/IUser'; +import type { IUser } from '../../definition/IUser'; -export const getUserEmailAddress = (user: IUser): IUserEmail | undefined => - (Array.isArray(user.emails) ? user.emails.find(({ address }) => !!address) : undefined); +export const getUserEmailAddress = (user: IUser): string | undefined => + (Array.isArray(user.emails) ? user.emails.find(({ address }) => !!address)?.address : undefined); diff --git a/client/lib/getUserEmailVerified.ts b/client/lib/getUserEmailVerified.ts new file mode 100644 index 000000000000..54270a3a0c57 --- /dev/null +++ b/client/lib/getUserEmailVerified.ts @@ -0,0 +1,4 @@ +import type { IUser } from '../../definition/IUser'; + +export const getUserEmailVerified = (user: IUser): boolean | undefined => + (Array.isArray(user.emails) ? user.emails.find(({ verified }) => !!verified)?.verified : undefined); diff --git a/client/views/room/contextualBar/UserInfo/index.js b/client/views/room/contextualBar/UserInfo/index.js index f25fdaefc99d..36f6d17f315f 100644 --- a/client/views/room/contextualBar/UserInfo/index.js +++ b/client/views/room/contextualBar/UserInfo/index.js @@ -17,6 +17,7 @@ import UserActions from './actions/UserActions'; import { useEndpointData } from '../../../../hooks/useEndpointData'; import { AsyncStatePhase } from '../../../../hooks/useAsyncState'; import { getUserEmailAddress } from '../../../../lib/getUserEmailAddress'; +import { getUserEmailVerified } from '../../../../lib/getUserEmailVerified'; const Label = (props) => ; @@ -32,6 +33,7 @@ export const UserInfo = React.memo(function UserInfo({ username, bio, email, + verified, showRealNames, status, phone, @@ -105,10 +107,10 @@ export const UserInfo = React.memo(function UserInfo({ {email && <> - {email.address} + {email} - {email.verified && {t('Verified')}} - {email.verified || {t('Not_verified')}} + {verified && {t('Verified')}} + {verified || {t('Not_verified')}} } @@ -178,6 +180,7 @@ export const UserInfoWithData = React.memo(function UserInfoWithData({ uid, user bio, phone: user.phone, customFields: user.customFields, + verified: getUserEmailVerified(user), email: getUserEmailAddress(user), utcOffset, createdAt: user.createdAt,