Invert non config filtering (#5674)
* Invert filtering logic * Rename * Rm comment
This commit is contained in:
@@ -35,7 +35,7 @@ function ReportDialogInner(props: ReportDialogProps) {
|
|||||||
isLoading: isLabelerLoading,
|
isLoading: isLabelerLoading,
|
||||||
data: labelers,
|
data: labelers,
|
||||||
error,
|
error,
|
||||||
} = useMyLabelersQuery()
|
} = useMyLabelersQuery({excludeNonConfigurableLabelers: true})
|
||||||
const isLoading = useDelayedLoading(500, isLabelerLoading)
|
const isLoading = useDelayedLoading(500, isLabelerLoading)
|
||||||
|
|
||||||
const ref = React.useRef<ScrollView>(null)
|
const ref = React.useRef<ScrollView>(null)
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ export function ModerationScreenInner({
|
|||||||
isLoading: isLabelersLoading,
|
isLoading: isLabelersLoading,
|
||||||
data: labelers,
|
data: labelers,
|
||||||
error: labelersError,
|
error: labelersError,
|
||||||
} = useMyLabelersQuery({includeNonConfigurable: true})
|
} = useMyLabelersQuery()
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
React.useCallback(() => {
|
React.useCallback(() => {
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ export const DEFAULT_LOGGED_OUT_LABEL_PREFERENCES: typeof DEFAULT_LABEL_SETTINGS
|
|||||||
)
|
)
|
||||||
|
|
||||||
export function useMyLabelersQuery({
|
export function useMyLabelersQuery({
|
||||||
includeNonConfigurable = false,
|
excludeNonConfigurableLabelers = false,
|
||||||
}: {
|
}: {
|
||||||
includeNonConfigurable?: boolean
|
excludeNonConfigurableLabelers?: boolean
|
||||||
} = {}) {
|
} = {}) {
|
||||||
const prefs = usePreferencesQuery()
|
const prefs = usePreferencesQuery()
|
||||||
let dids = Array.from(
|
let dids = Array.from(
|
||||||
@@ -30,14 +30,9 @@ export function useMyLabelersQuery({
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
if (excludeNonConfigurableLabelers) {
|
||||||
/*
|
|
||||||
* By default, remove non-configurable moderation authorities
|
|
||||||
*/
|
|
||||||
if (!includeNonConfigurable) {
|
|
||||||
dids = dids.filter(did => !isNonConfigurableModerationAuthority(did))
|
dids = dids.filter(did => !isNonConfigurableModerationAuthority(did))
|
||||||
}
|
}
|
||||||
|
|
||||||
const labelers = useLabelersDetailedInfoQuery({dids})
|
const labelers = useLabelersDetailedInfoQuery({dids})
|
||||||
const isLoading = prefs.isLoading || labelers.isLoading
|
const isLoading = prefs.isLoading || labelers.isLoading
|
||||||
const error = prefs.error || labelers.error
|
const error = prefs.error || labelers.error
|
||||||
@@ -51,7 +46,7 @@ export function useMyLabelersQuery({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function useLabelDefinitionsQuery() {
|
export function useLabelDefinitionsQuery() {
|
||||||
const labelers = useMyLabelersQuery({includeNonConfigurable: true})
|
const labelers = useMyLabelersQuery()
|
||||||
return React.useMemo(() => {
|
return React.useMemo(() => {
|
||||||
return {
|
return {
|
||||||
labelDefs: Object.fromEntries(
|
labelDefs: Object.fromEntries(
|
||||||
|
|||||||
Reference in New Issue
Block a user