Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/pages/ProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ function ProfilePage({route}: ProfilePageProps) {
const {translate, formatPhoneNumber} = useLocalize();
const accountID = Number(route.params?.accountID ?? 0);
const isCurrentUser = session?.accountID === accountID;
const details: PersonalDetails | EmptyObject = personalDetails?.[accountID] ?? (ValidationUtils.isValidAccountRoute(accountID) ? {} : {accountID: 0});
const isValidAccountID = ValidationUtils.isValidAccountRoute(accountID);
const details: PersonalDetails | EmptyObject = personalDetails?.[accountID] ?? (isValidAccountID ? {} : {accountID: 0});

const displayName = PersonalDetailsUtils.getDisplayNameOrDefault(details, undefined, undefined, isCurrentUser);
const fallbackIcon = details?.fallbackIcon ?? '';
Expand All @@ -116,6 +117,7 @@ function ProfilePage({route}: ProfilePageProps) {

const hasAvatar = Boolean(details.avatar);
const isLoading = Boolean(personalDetailsMetadata?.[accountID]?.isLoading) || isEmptyObject(details);
const shouldShowBlockingView = (!isValidAccountID && !isLoading) || CONST.RESTRICTED_ACCOUNT_IDS.includes(accountID);

const statusEmojiCode = details?.status?.emojiCode ?? '';
const statusText = details?.status?.text ?? '';
Expand All @@ -139,7 +141,7 @@ function ProfilePage({route}: ProfilePageProps) {

return (
<ScreenWrapper testID={ProfilePage.displayName}>
<FullPageNotFoundView shouldShow={CONST.RESTRICTED_ACCOUNT_IDS.includes(accountID)}>
<FullPageNotFoundView shouldShow={shouldShowBlockingView}>
<HeaderWithBackButton
title={translate('common.profile')}
onBackButtonPress={() => Navigation.goBack(navigateBackTo)}
Expand Down