Page MenuHomePhabricator

[web] Prepare a list of users that should be displayed
ClosedPublic

Authored by tomek on Jun 21 2022, 5:14 AM.
Tags
None
Referenced Files
F2906802: D4305.diff
Sun, Oct 6, 10:01 AM
Unknown Object (File)
Wed, Sep 25, 3:07 AM
Unknown Object (File)
Tue, Sep 24, 5:50 PM
Unknown Object (File)
Mon, Sep 9, 7:04 PM
Unknown Object (File)
Mon, Sep 9, 7:04 PM
Unknown Object (File)
Mon, Sep 9, 7:04 PM
Unknown Object (File)
Mon, Sep 9, 7:04 PM
Unknown Object (File)
Mon, Sep 9, 7:01 PM

Details

Summary

Create a list of users and sort it by username.

Depends on D4269

Test Plan

Render the component and check if the list is sorted correctly.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

tomek requested review of this revision.Jun 21 2022, 5:19 AM

Looks good! Added alternative approach using .map(...).sort(...) as an inline comment, but feel free to land with either approach

web/settings/relationship/add-users-list.react.js
73–79 ↗(On Diff #13619)

Not sure if this is more/less readable, but I think we could do something like this as well:

return mergedUserInfos
  .map(({ userID }) => mergedUserInfos[userID])
  .sort((user1, user2) => user1.username.localeCompare(user2.username));
This revision is now accepted and ready to land.Jun 21 2022, 10:12 AM
web/settings/relationship/add-users-list.react.js
73–79 ↗(On Diff #13619)

Good catch - using functional approach is an improvement.

Your proposition needs to be modified, because mergedUserInfos is an object. We should use Object.keys(mergedUserInfos) instead.

Use more functional approach