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)
Tue, Oct 15, 3:28 AM
Unknown Object (File)
Mon, Oct 14, 5:06 PM
Unknown Object (File)
Mon, Oct 14, 12:33 PM
Unknown Object (File)
Mon, Oct 14, 10:24 AM
Unknown Object (File)
Sat, Oct 12, 10:32 AM
Unknown Object (File)
Tue, Oct 1, 5:34 PM
Unknown Object (File)
Tue, Oct 1, 5:27 PM
Unknown Object (File)
Sat, Sep 21, 3:20 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
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