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)
Fri, Dec 20, 5:30 AM
Unknown Object (File)
Fri, Dec 13, 8:48 AM
Unknown Object (File)
Mon, Nov 25, 10:07 AM
Unknown Object (File)
Mon, Nov 25, 7:55 AM
Unknown Object (File)
Fri, Nov 22, 3:48 AM
Unknown Object (File)
Fri, Nov 22, 3:05 AM
Unknown Object (File)
Nov 21 2024, 10:27 PM
Unknown Object (File)
Nov 3 2024, 1:47 PM
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
Lint Not Applicable
Unit
Tests Not Applicable

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 ↗(On Diff #31146)

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