There are places where we want to check which `ThreadInfo`s in a collection have a given `ThreadPermission`. In these situations, we call `threadHasPermission` in some sort of `for-loop` or in the body of a `.filter`.
Now that we're moving from `threadHasPermission` to `useThreadHasPermission`, we have the issue where calling `useThreadHasPermission` within a `for-loop` or `.filter` for each `ThreadInfo` would violate the rules of hooks. Instead, we introduce a new hook that filters out `ThreadInfo`s that don't have a given `ThreadPermission`.
The original implementation of `useThreadsWithPermission` was 90% the same as `useThreadHasPermission`, so it made sense to consume `useThreadsWithPermission` within `useThreadHasPermission` to reduce duplication. Also considered pulling logic out into helper function, but thought this approach was cleaner.
---
Depends on D11916