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, Jul 6, 7:13 PM
Unknown Object (File)
Sat, Jul 6, 4:19 AM
Unknown Object (File)
Tue, Jul 2, 4:50 PM
Unknown Object (File)
Sat, Jun 29, 5:39 AM
Unknown Object (File)
Thu, Jun 27, 7:23 PM
Unknown Object (File)
Wed, Jun 26, 4:55 PM
Unknown Object (File)
Tue, Jun 25, 12:43 PM
Unknown Object (File)
Thu, Jun 20, 8:25 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
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