From 377fb100125d8f6532902730da693382f7f81c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Ch=C3=A1vez?= Date: Mon, 29 Apr 2024 18:56:58 -0600 Subject: [PATCH 1/3] Hide anonymous email if current user is anonymous --- src/pages/ProfilePage.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/ProfilePage.tsx b/src/pages/ProfilePage.tsx index a8e4223c0180..f8f88e9cc3cf 100755 --- a/src/pages/ProfilePage.tsx +++ b/src/pages/ProfilePage.tsx @@ -190,7 +190,8 @@ function ProfilePage({route}: ProfilePageProps) { )} - {login ? ( + {/* Don't display email if current user is anonymous */} + {!(isCurrentUser && SessionActions.isAnonymousUser()) && login ? ( Date: Mon, 29 Apr 2024 19:32:04 -0600 Subject: [PATCH 2/3] Hide email for anonymous user in user details tooltip --- .../UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx b/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx index 592cec3beca5..309b6551c511 100644 --- a/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx +++ b/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx @@ -12,15 +12,20 @@ import * as LocalePhoneNumber from '@libs/LocalePhoneNumber'; import * as ReportUtils from '@libs/ReportUtils'; import * as UserUtils from '@libs/UserUtils'; import CONST from '@src/CONST'; +import ONYXKEYS from '@src/ONYXKEYS'; +import {useOnyx} from 'react-native-onyx'; +import {isAnonymousUser} from '@libs/actions/Session'; function BaseUserDetailsTooltip({accountID, fallbackUserDetails, icon, delegateAccountID, shiftHorizontal, children}: UserDetailsTooltipProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); const personalDetails = usePersonalDetails(); + const [session] = useOnyx(ONYXKEYS.SESSION); + const isCurrentUserAnonymous = session?.accountID === accountID && isAnonymousUser(session); const userDetails = personalDetails?.[accountID] ?? fallbackUserDetails ?? {}; let userDisplayName = ReportUtils.getUserDetailTooltipText(accountID, userDetails.displayName ? userDetails.displayName.trim() : ''); - let userLogin = userDetails.login?.trim() && userDetails.login !== userDetails.displayName ? Str.removeSMSDomain(userDetails.login) : ''; + let userLogin = !isCurrentUserAnonymous && userDetails.login?.trim() && userDetails.login !== userDetails.displayName ? Str.removeSMSDomain(userDetails.login) : ''; let userAvatar = userDetails.avatar; let userAccountID = accountID; From 6c9ad8f5e1d58e603a99934820b19f7c921bbbaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Ch=C3=A1vez?= Date: Mon, 29 Apr 2024 21:04:57 -0600 Subject: [PATCH 3/3] Fix lint errors --- .../UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx b/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx index 309b6551c511..0f7316062027 100644 --- a/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx +++ b/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx @@ -1,6 +1,7 @@ import Str from 'expensify-common/lib/str'; import React, {useCallback} from 'react'; import {View} from 'react-native'; +import {useOnyx} from 'react-native-onyx'; import Avatar from '@components/Avatar'; import {usePersonalDetails} from '@components/OnyxProvider'; import Text from '@components/Text'; @@ -8,13 +9,12 @@ import Tooltip from '@components/Tooltip'; import type UserDetailsTooltipProps from '@components/UserDetailsTooltip/types'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import {isAnonymousUser} from '@libs/actions/Session'; import * as LocalePhoneNumber from '@libs/LocalePhoneNumber'; import * as ReportUtils from '@libs/ReportUtils'; import * as UserUtils from '@libs/UserUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -import {useOnyx} from 'react-native-onyx'; -import {isAnonymousUser} from '@libs/actions/Session'; function BaseUserDetailsTooltip({accountID, fallbackUserDetails, icon, delegateAccountID, shiftHorizontal, children}: UserDetailsTooltipProps) { const styles = useThemeStyles();