From 773ea3d6804414da94af6226be52688b1d66a622 Mon Sep 17 00:00:00 2001 From: Mateusz Titz Date: Wed, 29 May 2024 17:03:33 +0200 Subject: [PATCH 1/2] Fix normal Profile Page displayed for invalid accountID --- src/pages/ProfilePage.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/ProfilePage.tsx b/src/pages/ProfilePage.tsx index 7ce9bcf47c9c..12ad93a96276 100755 --- a/src/pages/ProfilePage.tsx +++ b/src/pages/ProfilePage.tsx @@ -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 ?? ''; @@ -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 statusEmojiCode = details?.status?.emojiCode ?? ''; const statusText = details?.status?.text ?? ''; @@ -139,7 +141,7 @@ function ProfilePage({route}: ProfilePageProps) { return ( - + Navigation.goBack(navigateBackTo)} From 466639fb753392c1e59cd3d49513f4e7e813a6c1 Mon Sep 17 00:00:00 2001 From: Mateusz Titz Date: Thu, 30 May 2024 17:15:29 +0200 Subject: [PATCH 2/2] Add fixes after review --- src/pages/ProfilePage.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/ProfilePage.tsx b/src/pages/ProfilePage.tsx index 12ad93a96276..58e8e7e2e45a 100755 --- a/src/pages/ProfilePage.tsx +++ b/src/pages/ProfilePage.tsx @@ -92,8 +92,8 @@ function ProfilePage({route}: ProfilePageProps) { const {translate, formatPhoneNumber} = useLocalize(); const accountID = Number(route.params?.accountID ?? 0); const isCurrentUser = session?.accountID === accountID; - const isValidAccountId = ValidationUtils.isValidAccountRoute(accountID); - const details: PersonalDetails | EmptyObject = personalDetails?.[accountID] ?? (isValidAccountId ? {} : {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 ?? ''; @@ -117,7 +117,7 @@ function ProfilePage({route}: ProfilePageProps) { const hasAvatar = Boolean(details.avatar); const isLoading = Boolean(personalDetailsMetadata?.[accountID]?.isLoading) || isEmptyObject(details); - const shouldShowBlockingView = !isValidAccountId && !isLoading; + const shouldShowBlockingView = (!isValidAccountID && !isLoading) || CONST.RESTRICTED_ACCOUNT_IDS.includes(accountID); const statusEmojiCode = details?.status?.emojiCode ?? ''; const statusText = details?.status?.text ?? ''; @@ -141,7 +141,7 @@ function ProfilePage({route}: ProfilePageProps) { return ( - + Navigation.goBack(navigateBackTo)}