diff --git a/src/CONST.ts b/src/CONST.ts index 1889fe0acfd6..5c99c5877559 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1587,6 +1587,15 @@ const CONST = { ]; }, + // Emails that profile view is prohibited + get RESTRICTED_EMAILS(): readonly string[] { + return [this.EMAIL.NOTIFICATIONS]; + }, + // Account IDs that profile view is prohibited + get RESTRICTED_ACCOUNT_IDS() { + return [this.ACCOUNT_ID.NOTIFICATIONS]; + }, + // Auth limit is 60k for the column but we store edits and other metadata along the html so let's use a lower limit to accommodate for it. MAX_COMMENT_LENGTH: 10000, diff --git a/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx b/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx index 4535874c3fac..0b4b7805f864 100644 --- a/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx +++ b/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx @@ -46,6 +46,9 @@ function BaseUserDetailsTooltip({accountID, fallbackUserDetails, icon, delegateA subtitle = ''; } } + if (CONST.RESTRICTED_ACCOUNT_IDS.includes(userAccountID) || CONST.RESTRICTED_EMAILS.includes(userLogin.trim())) { + subtitle = ''; + } const renderTooltipContent = useCallback( () => ( diff --git a/src/pages/DetailsPage.tsx b/src/pages/DetailsPage.tsx index 76733fbf25e6..d4438d3141bf 100755 --- a/src/pages/DetailsPage.tsx +++ b/src/pages/DetailsPage.tsx @@ -100,7 +100,7 @@ function DetailsPage({personalDetails, route, session}: DetailsPageProps) { return ( - + {details ? ( diff --git a/src/pages/ProfilePage.js b/src/pages/ProfilePage.js index c933e22dd8ea..68bd3d76888d 100755 --- a/src/pages/ProfilePage.js +++ b/src/pages/ProfilePage.js @@ -8,6 +8,7 @@ import _ from 'underscore'; import AutoUpdateTime from '@components/AutoUpdateTime'; import Avatar from '@components/Avatar'; import BlockingView from '@components/BlockingViews/BlockingView'; +import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; import CommunicationsLink from '@components/CommunicationsLink'; import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; @@ -144,122 +145,124 @@ function ProfilePage(props) { return ( - Navigation.goBack(navigateBackTo)} - /> - - {hasMinimumDetails && ( - - - Navigation.navigate(ROUTES.PROFILE_AVATAR.getRoute(String(accountID)))} - accessibilityLabel={props.translate('common.profile')} - accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON} - > - - - - - {Boolean(displayName) && ( - + Navigation.goBack(navigateBackTo)} + /> + + {hasMinimumDetails && ( + + + Navigation.navigate(ROUTES.PROFILE_AVATAR.getRoute(String(accountID)))} + accessibilityLabel={props.translate('common.profile')} + accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON} > - {displayName} - - )} - {hasStatus && ( - + + + + + {Boolean(displayName) && ( - {props.translate('statusPage.status')} + {displayName} - {statusContent} - - )} + )} + {hasStatus && ( + + + {props.translate('statusPage.status')} + + {statusContent} + + )} - {login ? ( - - - {props.translate(isSMSLogin ? 'common.phoneNumber' : 'common.email')} - - - - {isSMSLogin ? props.formatPhoneNumber(phoneNumber) : login} - - - - ) : null} - {pronouns ? ( - - - {props.translate('profilePage.preferredPronouns')} - - {pronouns} - - ) : null} - {shouldShowLocalTime && } - - {shouldShowNotificationPreference && ( - Navigation.navigate(ROUTES.REPORT_SETTINGS_NOTIFICATION_PREFERENCES.getRoute(props.report.reportID))} - wrapperStyle={[styles.mtn6, styles.mb5]} - /> - )} - {!isCurrentUser && !Session.isAnonymousUser() && ( - Report.navigateToAndOpenReportWithAccountIDs([accountID])} - wrapperStyle={styles.breakAll} - shouldShowRightIcon - /> - )} - {!_.isEmpty(props.report) && ( - ReportUtils.navigateToPrivateNotes(props.report, props.session)} - wrapperStyle={styles.breakAll} - shouldShowRightIcon - brickRoadIndicator={Report.hasErrorInPrivateNotes(props.report) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''} - /> - )} - - )} - {!hasMinimumDetails && isLoading && } - {shouldShowBlockingView && ( - - )} - + {login ? ( + + + {props.translate(isSMSLogin ? 'common.phoneNumber' : 'common.email')} + + + + {isSMSLogin ? props.formatPhoneNumber(phoneNumber) : login} + + + + ) : null} + {pronouns ? ( + + + {props.translate('profilePage.preferredPronouns')} + + {pronouns} + + ) : null} + {shouldShowLocalTime && } + + {shouldShowNotificationPreference && ( + Navigation.navigate(ROUTES.REPORT_SETTINGS_NOTIFICATION_PREFERENCES.getRoute(props.report.reportID))} + wrapperStyle={[styles.mtn6, styles.mb5]} + /> + )} + {!isCurrentUser && !Session.isAnonymousUser() && ( + Report.navigateToAndOpenReportWithAccountIDs([accountID])} + wrapperStyle={styles.breakAll} + shouldShowRightIcon + /> + )} + {!_.isEmpty(props.report) && ( + ReportUtils.navigateToPrivateNotes(props.report, props.session)} + wrapperStyle={styles.breakAll} + shouldShowRightIcon + brickRoadIndicator={Report.hasErrorInPrivateNotes(props.report) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''} + /> + )} + + )} + {!hasMinimumDetails && isLoading && } + {shouldShowBlockingView && ( + + )} + + ); } diff --git a/src/pages/ReportParticipantsPage.tsx b/src/pages/ReportParticipantsPage.tsx index 694284a900d0..b560ce672ae4 100755 --- a/src/pages/ReportParticipantsPage.tsx +++ b/src/pages/ReportParticipantsPage.tsx @@ -45,7 +45,8 @@ const getAllParticipants = ( ReportUtils.getVisibleMemberIDs(report) .map((accountID, index) => { const userPersonalDetail = personalDetails?.[accountID]; - const userLogin = LocalePhoneNumber.formatPhoneNumber(userPersonalDetail?.login ?? '') ?? translate('common.hidden'); + const userLogin = + !!userPersonalDetail?.login && !CONST.RESTRICTED_ACCOUNT_IDS.includes(accountID) ? LocalePhoneNumber.formatPhoneNumber(userPersonalDetail.login) : translate('common.hidden'); const displayName = PersonalDetailsUtils.getDisplayNameOrDefault(userPersonalDetail); return { @@ -76,7 +77,7 @@ function ReportParticipantsPage({report, personalDetails}: ReportParticipantsPag const participants = getAllParticipants(report, personalDetails, translate).map((participant) => ({ ...participant, - isDisabled: participant?.accountID ? ReportUtils.isOptimisticPersonalDetail(participant.accountID) : false, + isDisabled: ReportUtils.isOptimisticPersonalDetail(participant.accountID ?? 0) || CONST.RESTRICTED_ACCOUNT_IDS.includes(participant.accountID ?? 0), })); return ( diff --git a/src/pages/home/report/ReportActionCompose/SuggestionMention.js b/src/pages/home/report/ReportActionCompose/SuggestionMention.js index f528435e536b..152ce54d5481 100644 --- a/src/pages/home/report/ReportActionCompose/SuggestionMention.js +++ b/src/pages/home/report/ReportActionCompose/SuggestionMention.js @@ -150,6 +150,10 @@ function SuggestionMention({ if (!detail.login || detail.isOptimisticPersonalDetail) { return false; } + // We don't want to mention system emails like notifications@expensify.com + if (CONST.RESTRICTED_EMAILS.includes(detail.login) || CONST.RESTRICTED_ACCOUNT_IDS.includes(detail.accountID)) { + return false; + } const displayName = PersonalDetailsUtils.getDisplayNameOrDefault(detail); const displayText = displayName === formatPhoneNumber(detail.login) ? displayName : `${displayName} ${detail.login}`; if (searchValue && !displayText.toLowerCase().includes(searchValue.toLowerCase())) { diff --git a/src/pages/home/report/ReportActionItemSingle.tsx b/src/pages/home/report/ReportActionItemSingle.tsx index eb5e633573f7..18f261024fd6 100644 --- a/src/pages/home/report/ReportActionItemSingle.tsx +++ b/src/pages/home/report/ReportActionItemSingle.tsx @@ -161,7 +161,7 @@ function ReportActionItemSingle({ const shouldDisableDetailPage = useMemo( () => - actorAccountID === CONST.ACCOUNT_ID.NOTIFICATIONS || + CONST.RESTRICTED_ACCOUNT_IDS.includes(actorAccountID ?? 0) || (!isWorkspaceActor && ReportUtils.isOptimisticPersonalDetail(action.delegateAccountID ? Number(action.delegateAccountID) : actorAccountID ?? -1)), [action, isWorkspaceActor, actorAccountID], );