Additional moderation (#5172)
* Set up additional mod authorities * Filter out non-configurable mod authorities * WIP * Working * Cleanup, add mod * Cleanup * Add more debug logs * Tweak logs * Filter out imperative labels from typeaheads * Filter hideable content from notifications * Add api * Fall back in dev * Remove space * Use prod endpoint * Add tiny notice * Add notice to labeler card, show all labelers
This commit is contained in:
@@ -2,7 +2,7 @@ import React from 'react'
|
||||
import {AppBskyActorDefs, moderateProfile, ModerationOpts} from '@atproto/api'
|
||||
import {keepPreviousData, useQuery, useQueryClient} from '@tanstack/react-query'
|
||||
|
||||
import {isJustAMute} from '#/lib/moderation'
|
||||
import {isJustAMute, moduiContainsHideableOffense} from '#/lib/moderation'
|
||||
import {logger} from '#/logger'
|
||||
import {STALE} from '#/state/queries'
|
||||
import {useAgent} from '#/state/session'
|
||||
@@ -113,6 +113,10 @@ function computeSuggestions({
|
||||
return items.filter(profile => {
|
||||
const modui = moderateProfile(profile, moderationOpts).ui('profileList')
|
||||
const isExactMatch = q && profile.handle.toLowerCase() === q
|
||||
return isExactMatch || !modui.filter || isJustAMute(modui)
|
||||
return (
|
||||
(isExactMatch && !moduiContainsHideableOffense(modui)) ||
|
||||
!modui.filter ||
|
||||
isJustAMute(modui)
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
import {QueryClient} from '@tanstack/react-query'
|
||||
import chunk from 'lodash.chunk'
|
||||
|
||||
import {labelIsHideableOffense} from '#/lib/moderation'
|
||||
import {precacheProfile} from '../profile'
|
||||
import {FeedNotification, FeedPage, NotificationType} from './types'
|
||||
|
||||
@@ -104,6 +105,10 @@ export function shouldFilterNotif(
|
||||
notif: AppBskyNotificationListNotifications.Notification,
|
||||
moderationOpts: ModerationOpts | undefined,
|
||||
): boolean {
|
||||
const containsImperative = !!notif.author.labels?.some(labelIsHideableOffense)
|
||||
if (containsImperative) {
|
||||
return true
|
||||
}
|
||||
if (!moderationOpts) {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user