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
Unknown Object (File)
Sun, Dec 15, 4:48 PM
Unknown Object (File)
Sun, Dec 15, 4:48 PM
Unknown Object (File)
Thu, Nov 21, 5:12 PM
Unknown Object (File)
Nov 9 2024, 7:59 AM
Unknown Object (File)
Oct 14 2024, 12:46 AM
Unknown Object (File)
Oct 14 2024, 12:46 AM
Unknown Object (File)
Oct 14 2024, 12:46 AM
Unknown Object (File)
Oct 14 2024, 12:46 AM

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
Lint Not Applicable
Unit
Tests Not Applicable

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