Page MenuHomePhabricator

[native] update UserProfileBottomSheet to get a userInfo from a userID
ClosedPublic

Authored by ginsu on Sep 10 2023, 11:08 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 3, 1:47 PM
Unknown Object (File)
Thu, Oct 24, 1:40 AM
Unknown Object (File)
Thu, Oct 24, 12:50 AM
Unknown Object (File)
Oct 20 2024, 9:30 AM
Unknown Object (File)
Oct 20 2024, 9:30 AM
Unknown Object (File)
Oct 20 2024, 9:30 AM
Unknown Object (File)
Oct 20 2024, 9:30 AM
Unknown Object (File)
Oct 20 2024, 9:29 AM
Subscribers

Details

Summary

As a follow up to D9119 we can now update the userInfo in UserProfileBottomSheetParams to be a userID and use that to grab the userInfo using a selector. Another benefit of doing this is that this also makes navigating to UserProfileBottomSheet a lot more permissive since we only need to pass a userID (something similar to what we did with user avatars)

Depends on D9119

Test Plan

Please see the demo video below where I can view the user profile from the thread settings (uses a RelativeMemberInfo) and RelationshipList (which uses AccountUserInfo)

Also tested the case when we can't find user with an id not found in our store by hardcoding null for userInfo

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

Is it possible that a user with this id will not be in our store?

native/bottom-sheets/user-profile-bottom-sheet.react.js
30 ↗(On Diff #30910)

This should be typed as optional for the reason @inka identified

atul requested changes to this revision.Sep 12 2023, 1:33 PM

Sending back to your queue to address feedback from @inka/@ashoat

This revision now requires changes to proceed.Sep 12 2023, 1:33 PM
In D9120#269321, @inka wrote:

Is it possible that a user with this id will not be in our store?

Overall, we should be really cautious when accessing arrays in Flow https://flow.org/en/docs/types/arrays/#toc-array-access-is-unsafe.

lib/shared/user-utils.js
13

Not using this function but figured it would be good to make this function more permissive too since stringForUserExplicit now makes the user argument optional

This revision is now accepted and ready to land.Sep 20 2023, 1:51 PM
ginsu edited the test plan for this revision. (Show Details)

rebase before landing