Invert non config filtering (#5674)

* Invert filtering logic

* Rename

* Rm comment
This commit is contained in:
Eric Bailey
2024-10-10 12:04:23 -05:00
committed by GitHub
parent 96cc31babc
commit 3b44ea203c
3 changed files with 6 additions and 11 deletions
+4 -9
View File
@@ -18,9 +18,9 @@ export const DEFAULT_LOGGED_OUT_LABEL_PREFERENCES: typeof DEFAULT_LABEL_SETTINGS
)
export function useMyLabelersQuery({
includeNonConfigurable = false,
excludeNonConfigurableLabelers = false,
}: {
includeNonConfigurable?: boolean
excludeNonConfigurableLabelers?: boolean
} = {}) {
const prefs = usePreferencesQuery()
let dids = Array.from(
@@ -30,14 +30,9 @@ export function useMyLabelersQuery({
),
),
)
/*
* By default, remove non-configurable moderation authorities
*/
if (!includeNonConfigurable) {
if (excludeNonConfigurableLabelers) {
dids = dids.filter(did => !isNonConfigurableModerationAuthority(did))
}
const labelers = useLabelersDetailedInfoQuery({dids})
const isLoading = prefs.isLoading || labelers.isLoading
const error = prefs.error || labelers.error
@@ -51,7 +46,7 @@ export function useMyLabelersQuery({
}
export function useLabelDefinitionsQuery() {
const labelers = useMyLabelersQuery({includeNonConfigurable: true})
const labelers = useMyLabelersQuery()
return React.useMemo(() => {
return {
labelDefs: Object.fromEntries(