Page MenuHomePhabricator

[web] Introduce `AddMembersList` component
ClosedPublic

Authored by jacek on Apr 15 2022, 4:28 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Dec 7, 6:00 PM
Unknown Object (File)
Fri, Dec 6, 4:34 PM
Unknown Object (File)
Sun, Dec 1, 5:36 PM
Unknown Object (File)
Sun, Dec 1, 5:28 PM
Unknown Object (File)
Sun, Dec 1, 5:18 PM
Unknown Object (File)
Nov 26 2024, 5:42 AM
Unknown Object (File)
Nov 26 2024, 4:20 AM
Unknown Object (File)
Nov 26 2024, 2:45 AM

Details

Summary

Introduce component grouping users and rendering list based on search results in AddMembersModal.
I used common logic with native app, where only users from parent thread have "notice" set to "undefined". It's the reason, why after grouping the title: "Users in parent thread" is added manually.

Screenshot_Google Chrome_2022-04-15_134858.png (803×457 px, 37 KB)

Test Plan

The list can be tested after introducing AddMembersModal

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tomek requested changes to this revision.Apr 15 2022, 9:22 AM
tomek added inline comments.
web/modals/threads/members/add-members-list.react.js
20–21 ↗(On Diff #11511)

We don't memoize these so all the following memoizations will recompute after each render.

37–45 ↗(On Diff #11511)

I think this code might become more readable when:

  1. We prepare all the data before this memo e.g.
_toPairs(groupedAvailableUsersList)
        .filter(group => group[0] !== 'undefined')
        .sort((a, b) => a[0].localeCompare(b[0]))
  1. We store simple values instead of creating arrays just to destructure them (see suggested edit)
This revision now requires changes to proceed.Apr 15 2022, 9:22 AM

Add missing useMemo and make the component more readable

tomek added a reviewer: ashoat.

Adding @ashoat as this diff affects the copy presented to users.

web/modals/threads/members/add-members-list.react.js
13 ↗(On Diff #11778)
21 ↗(On Diff #11778)

Shouldn't we use alertText?

32 ↗(On Diff #11778)

Just wondering, maybe we can change the logic a bit and replace undefined by something defined, so that it's more maintainable?

web/modals/threads/members/add-members-list.react.js
13 ↗(On Diff #11778)

Can probably use $ReadOnlySet<string> here instead?

Fixes after review & capitalize headers

This revision is now accepted and ready to land.Apr 25 2022, 10:10 AM