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)
Sat, Nov 9, 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
Unknown Object (File)
Oct 14 2024, 12:42 AM
Unknown Object (File)
Oct 6 2024, 12:22 PM
Unknown Object (File)
Oct 6 2024, 10:01 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