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)
Sat, Jun 15, 8:31 AM
Unknown Object (File)
Wed, Jun 12, 4:46 PM
Unknown Object (File)
May 28 2024, 11:25 AM
Unknown Object (File)
May 28 2024, 11:25 AM
Unknown Object (File)
May 28 2024, 11:25 AM
Unknown Object (File)
May 28 2024, 11:25 AM
Unknown Object (File)
May 28 2024, 11:25 AM
Unknown Object (File)
May 28 2024, 11:25 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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.