Page MenuHomePhabricator

[web] Call useRoleNamesFromCommunityThreadInfo to help filter Admin members
ClosedPublic

Authored by rohan on Oct 17 2023, 8:45 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 29, 5:44 AM
Unknown Object (File)
Fri, Nov 29, 5:42 AM
Unknown Object (File)
Fri, Nov 29, 3:51 AM
Unknown Object (File)
Thu, Nov 21, 3:42 AM
Unknown Object (File)
Oct 30 2024, 8:55 AM
Unknown Object (File)
Oct 30 2024, 8:55 AM
Unknown Object (File)
Oct 30 2024, 8:55 AM
Unknown Object (File)
Oct 30 2024, 8:55 AM
Subscribers

Details

Summary

In an effort to unify the role name checking logic, I'm using useRoleNamesFromCommunityThreadInfo instead of memberIsAdmin(member, threadInfo) || memberHasAdminPowers(member), and then filtering out all of the role names that are not 'Admins'. This is the only way we have to check for Admins right now, but the isAdminRole work that's coming soon will help make these checks a lot more concrete.

Resolves https://linear.app/comm/issue/ENG-5178/ashoat-shows-up-under-admins-column-but-with-members-pill

Depends on D9430

Test Plan

Confirmed that all Admins show up when filtering out the members in both community roots and subchannels, and that GENESIS doesn't crash

Diff Detail

Repository
rCOMM Comm
Branch
ENG-5178
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

Rename adminsMap to roleNames to be consistent

Harbormaster returned this revision to the author for changes because remote builds failed.Oct 17 2023, 8:57 AM
Harbormaster failed remote builds in B23290: Diff 32084!
Harbormaster failed remote builds in B23291: Diff 32085!
rohan requested review of this revision.Oct 17 2023, 9:21 AM

This is the only way we have to check for Admins right now, but the isAdminRole work that's coming soon will help make these checks a lot more concrete.

Bookmarked this diff to make sure it's updated following isAdminRole work.

This revision is now accepted and ready to land.Oct 17 2023, 9:30 AM
In D9513#278861, @atul wrote:

Bookmarked this diff to make sure it's updated following isAdminRole work.

Thank you!

web/modals/threads/members/members-modal.react.js
52 ↗(On Diff #32086)

Please use the roleIsAdminRole utility here. By doing this comparison in a "one-off" way you're making it harder to refactor later

This revision was landed with ongoing or failed builds.Oct 20 2023, 9:05 AM
This revision was automatically updated to reflect the committed changes.