[lib] Add memberHasAdminRole check to useThreadsWithPermission
Summary:
The logic here is the "updated version" of the threadOrParentThreadHasAdminRole early return check in threadIsWithBlockedUserOnly.
Rather than depending on the "sketchy CHANGE_ROLE check" that we were using in memberHasAdminPowers, we use the updated logic where we check if there's a member that has admin role in community root.
If there is, we know that we don't need to patch/filter permissions.
Depends on D12145
Test Plan:
- Added log statements in useThreadsWithPermission that included thread name, permission name, and whether permission was enabled or disabled. They looked like the following:
- Used the app and navigated to a bunch of threads/screens to build up logs.
- Created script to compare logs from before and after the change to ensure that the values of permission for given thread remained same:
https://gist.github.com/atulsmadhugiri/3f1ac163e0f53b46f496001d4cedda3c
- Ran script and ensured that there were no differences (see output on bottom right):
(In hindsight I should've just logged threadName, permissionName, boolean as "CSV" so it would be super simple to split on comma, but had already collected large volume of logs)
Reviewers: ashoat, ginsu, tomek, varun
Reviewed By: ashoat
Differential Revision: https://phab.comm.dev/D12149