-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix normal Profile Page displayed for invalid accountID #42769
Fix normal Profile Page displayed for invalid accountID #42769
Conversation
this is how it was working before my PR: https://github.com/Expensify/App/pull/41846/files#diff-9ec781fc7bf783309e61fa0ee95b25697a7d9aae9de9564e1a09055c4f65b3cbL120 I tried to re-create similar logic but I don't want to base it on existence of |
src/pages/ProfilePage.tsx
Outdated
@@ -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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const shouldShowBlockingView = !isValidAccountId && !isLoading; | |
const shouldShowBlockingView = (!isValidAccountId && !isLoading) || CONST.RESTRICTED_ACCOUNT_IDS.includes(accountID); |
NAB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Reviewer Checklist
Screenshots/VideosAndroid: mWeb ChromeNetworking issue MacOS: DesktopCan't test due to a bug https://expensify.slack.com/archives/C01GTK53T8Q/p1717012386285909 |
src/pages/ProfilePage.tsx
Outdated
@@ -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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming styles
const isValidAccountId = ValidationUtils.isValidAccountRoute(accountID); | |
const isValidAccountID = ValidationUtils.isValidAccountRoute(accountID); |
src/pages/ProfilePage.tsx
Outdated
@@ -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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
src/pages/ProfilePage.tsx
Outdated
@@ -139,7 +141,7 @@ function ProfilePage({route}: ProfilePageProps) { | |||
|
|||
return ( | |||
<ScreenWrapper testID={ProfilePage.displayName}> | |||
<FullPageNotFoundView shouldShow={CONST.RESTRICTED_ACCOUNT_IDS.includes(accountID)}> | |||
<FullPageNotFoundView shouldShow={shouldShowBlockingView || CONST.RESTRICTED_ACCOUNT_IDS.includes(accountID)}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- the other suggestion
<FullPageNotFoundView shouldShow={shouldShowBlockingView || CONST.RESTRICTED_ACCOUNT_IDS.includes(accountID)}> | |
<FullPageNotFoundView shouldShow={shouldShowBlockingView}> |
@mountiny suggestions implemented |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @s77rt all good on your side too?
@mountiny Yes! Looks good to me 🚀 |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to production by https://github.com/Julesssss in version: 1.4.79-11 🚀
|
Details
accountID
is not an actual account id but a string, we will display NotFound PageFixed Issues
$ #42750
PROPOSAL:
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
rec-web-bugfix.mp4
MacOS: Desktop