diff --git a/src/components/moderation/GlobalModerationLabelPref.tsx b/src/components/moderation/GlobalModerationLabelPref.tsx index 8c22cf9e37..193460405d 100644 --- a/src/components/moderation/GlobalModerationLabelPref.tsx +++ b/src/components/moderation/GlobalModerationLabelPref.tsx @@ -1,6 +1,6 @@ import React from 'react' import {View} from 'react-native' -import {InterprettedLabelValueDefinition, LabelPreference} from '@atproto/api' +import {InterpretedLabelValueDefinition, LabelPreference} from '@atproto/api' import {useLingui} from '@lingui/react' import {msg} from '@lingui/macro' @@ -18,7 +18,7 @@ export function GlobalModerationLabelPref({ labelValueDefinition, disabled, }: { - labelValueDefinition: InterprettedLabelValueDefinition + labelValueDefinition: InterpretedLabelValueDefinition disabled?: boolean }) { const {_} = useLingui() diff --git a/src/components/moderation/ModerationLabelPref.tsx b/src/components/moderation/ModerationLabelPref.tsx index e021ee86c5..1bccaa8b68 100644 --- a/src/components/moderation/ModerationLabelPref.tsx +++ b/src/components/moderation/ModerationLabelPref.tsx @@ -1,6 +1,6 @@ import React from 'react' import {Pressable, View} from 'react-native' -import {InterprettedLabelValueDefinition, LabelPreference} from '@atproto/api' +import {InterpretedLabelValueDefinition, LabelPreference} from '@atproto/api' import {useLingui} from '@lingui/react' import {msg, Trans} from '@lingui/macro' @@ -27,7 +27,7 @@ export function ModerationLabelPref({ labelerDid, disabled, }: { - labelValueDefinition: InterprettedLabelValueDefinition + labelValueDefinition: InterpretedLabelValueDefinition labelerDid: string | undefined disabled?: boolean }) { @@ -39,9 +39,8 @@ export function ModerationLabelPref({ const {data: preferences} = usePreferencesQuery() const {mutate, variables} = usePreferencesSetContentLabelMutation() const savedPref = labelerDid - ? preferences?.moderationPrefs.mods.find(m => m.did === labelerDid)?.labels[ - identifier - ] + ? preferences?.moderationPrefs.labelers.find(l => l.did === labelerDid) + ?.labels[identifier] : preferences?.moderationPrefs.labels[identifier] const pref = variables?.visibility ?? savedPref ?? 'warn' diff --git a/src/lib/moderation.ts b/src/lib/moderation.ts index d806581a3c..2c34881112 100644 --- a/src/lib/moderation.ts +++ b/src/lib/moderation.ts @@ -1,7 +1,7 @@ import { ModerationCause, ModerationUI, - InterprettedLabelValueDefinition, + InterpretedLabelValueDefinition, LABELS, } from '@atproto/api' @@ -39,8 +39,8 @@ export function getModerationServiceTitle({ export function lookupLabelValueDefinition( labelValue: string, - customDefs: InterprettedLabelValueDefinition[] | undefined, -): InterprettedLabelValueDefinition | undefined { + customDefs: InterpretedLabelValueDefinition[] | undefined, +): InterpretedLabelValueDefinition | undefined { let def if (!labelValue.startsWith('!') && customDefs) { def = customDefs.find(d => d.identifier === labelValue) diff --git a/src/lib/moderation/useLabelBehaviorDescription.ts b/src/lib/moderation/useLabelBehaviorDescription.ts index e4624f3624..6a67ecf831 100644 --- a/src/lib/moderation/useLabelBehaviorDescription.ts +++ b/src/lib/moderation/useLabelBehaviorDescription.ts @@ -1,9 +1,9 @@ -import {InterprettedLabelValueDefinition, LabelPreference} from '@atproto/api' +import {InterpretedLabelValueDefinition, LabelPreference} from '@atproto/api' import {useLingui} from '@lingui/react' import {msg} from '@lingui/macro' export function useLabelBehaviorDescription( - labelValueDef: InterprettedLabelValueDefinition, + labelValueDef: InterpretedLabelValueDefinition, pref: LabelPreference, ) { const {_} = useLingui() @@ -39,7 +39,7 @@ export function useLabelBehaviorDescription( } export function useLabelLongBehaviorDescription( - labelValueDef: InterprettedLabelValueDefinition, + labelValueDef: InterpretedLabelValueDefinition, pref: LabelPreference, ) { const {_} = useLingui() diff --git a/src/lib/moderation/useLabelInfo.ts b/src/lib/moderation/useLabelInfo.ts index febdeb356b..21e3260be5 100644 --- a/src/lib/moderation/useLabelInfo.ts +++ b/src/lib/moderation/useLabelInfo.ts @@ -3,7 +3,7 @@ import { AppBskyLabelerDefs, LABELS, interpretLabelValueDefinition, - InterprettedLabelValueDefinition, + InterpretedLabelValueDefinition, } from '@atproto/api' import {useLingui} from '@lingui/react' import * as bcp47Match from 'bcp-47-match' @@ -16,7 +16,7 @@ import {useLabelDefinitions} from '#/state/queries/preferences' export interface LabelInfo { label: ComAtprotoLabelDefs.Label - def: InterprettedLabelValueDefinition + def: InterpretedLabelValueDefinition strings: ComAtprotoLabelDefs.LabelValueDefinitionStrings labeler: AppBskyLabelerDefs.LabelerViewDetailed | undefined } @@ -35,9 +35,9 @@ export function useLabelInfo(label: ComAtprotoLabelDefs.Label): LabelInfo { } export function getDefinition( - labelDefs: Record, + labelDefs: Record, label: ComAtprotoLabelDefs.Label, -): InterprettedLabelValueDefinition { +): InterpretedLabelValueDefinition { // check local definitions const customDef = !label.val.startsWith('!') && @@ -60,6 +60,7 @@ export function getDefinition( identifier: label.val, severity: 'none', blurs: 'none', + defaultSetting: 'ignore', locales: [], }, label.src, @@ -69,7 +70,7 @@ export function getDefinition( export function getLabelStrings( locale: string, globalLabelStrings: GlobalLabelStrings, - def: InterprettedLabelValueDefinition, + def: InterpretedLabelValueDefinition, ): ComAtprotoLabelDefs.LabelValueDefinitionStrings { if (!def.definedBy) { // global definition, look up strings diff --git a/src/screens/Moderation/index.tsx b/src/screens/Moderation/index.tsx index 6a4b09f2dc..dbb0f0203c 100644 --- a/src/screens/Moderation/index.tsx +++ b/src/screens/Moderation/index.tsx @@ -86,7 +86,9 @@ export function ModerationScreen( data: labelers, error: labelersError, } = useLabelersDetailedInfoQuery({ - dids: preferences ? preferences.moderationPrefs.mods.map(m => m.did) : [], + dids: preferences + ? preferences.moderationPrefs.labelers.map(l => l.did) + : [], }) const {gtMobile} = useBreakpoints() const {height} = useSafeAreaFrame() diff --git a/src/screens/Onboarding/StepModeration/ModerationOption.tsx b/src/screens/Onboarding/StepModeration/ModerationOption.tsx index 763a63f05d..182244e7bf 100644 --- a/src/screens/Onboarding/StepModeration/ModerationOption.tsx +++ b/src/screens/Onboarding/StepModeration/ModerationOption.tsx @@ -1,6 +1,6 @@ import React from 'react' import {View} from 'react-native' -import {LabelPreference, InterprettedLabelValueDefinition} from '@atproto/api' +import {LabelPreference, InterpretedLabelValueDefinition} from '@atproto/api' import {useLingui} from '@lingui/react' import {msg} from '@lingui/macro' import Animated, {Easing, Layout, FadeIn} from 'react-native-reanimated' @@ -18,7 +18,7 @@ export function ModerationOption({ labelValueDefinition, isMounted, }: { - labelValueDefinition: InterprettedLabelValueDefinition + labelValueDefinition: InterpretedLabelValueDefinition isMounted: React.MutableRefObject }) { const {_} = useLingui() diff --git a/src/screens/Profile/Header/ProfileHeaderLabeler.tsx b/src/screens/Profile/Header/ProfileHeaderLabeler.tsx index 7dd006c0b6..70ac65e4fc 100644 --- a/src/screens/Profile/Header/ProfileHeaderLabeler.tsx +++ b/src/screens/Profile/Header/ProfileHeaderLabeler.tsx @@ -75,10 +75,10 @@ let ProfileHeaderLabeler = ({ useLabelerSubscriptionMutation() const isSubscribed = variables?.subscribe ?? - preferences?.moderationPrefs.mods.find(mod => mod.did === profile.did) + preferences?.moderationPrefs.labelers.find(l => l.did === profile.did) const canSubscribe = isSubscribed || - (preferences ? preferences?.moderationPrefs.mods.length < 10 : false) + (preferences ? preferences?.moderationPrefs.labelers.length < 10 : false) const {mutateAsync: likeMod, isPending: isLikePending} = useLikeMutation() const {mutateAsync: unlikeMod, isPending: isUnlikePending} = useUnlikeMutation() diff --git a/src/screens/Profile/Sections/Labels.tsx b/src/screens/Profile/Sections/Labels.tsx index c7cdeeab17..e81d6c8843 100644 --- a/src/screens/Profile/Sections/Labels.tsx +++ b/src/screens/Profile/Sections/Labels.tsx @@ -4,7 +4,7 @@ import { AppBskyLabelerDefs, ModerationOpts, interpretLabelValueDefinitions, - InterprettedLabelValueDefinition, + InterpretedLabelValueDefinition, } from '@atproto/api' import {Trans, msg} from '@lingui/macro' import {useLingui} from '@lingui/react' @@ -126,8 +126,8 @@ export function ProfileLabelsSectionInner({ }) const {labelValues} = labelerInfo.policies - const isSubscribed = moderationOpts.prefs.mods.find( - mod => mod.did === labelerInfo.creator.did, + const isSubscribed = moderationOpts.prefs.labelers.find( + l => l.did === labelerInfo.creator.did, ) const labelDefs = React.useMemo(() => { const customDefs = interpretLabelValueDefinitions(labelerInfo) @@ -135,7 +135,7 @@ export function ProfileLabelsSectionInner({ .map(val => lookupLabelValueDefinition(val, customDefs)) .filter( def => def && def?.configurable, - ) as InterprettedLabelValueDefinition[] + ) as InterpretedLabelValueDefinition[] }, [labelerInfo, labelValues]) return ( diff --git a/src/state/queries/labeler.ts b/src/state/queries/labeler.ts index 06edd8b158..d5b7acd72c 100644 --- a/src/state/queries/labeler.ts +++ b/src/state/queries/labeler.ts @@ -73,9 +73,9 @@ export function useLabelerSubscriptionMutation() { }).parse({did, subscribe}) if (subscribe) { - await getAgent().addModService(did) + await getAgent().addLabeler(did) } else { - await getAgent().removeModService(did) + await getAgent().removeLabeler(did) } }, onSuccess() { diff --git a/src/state/queries/preferences/const.ts b/src/state/queries/preferences/const.ts index f03103581c..a5d3035d5c 100644 --- a/src/state/queries/preferences/const.ts +++ b/src/state/queries/preferences/const.ts @@ -37,7 +37,7 @@ export const DEFAULT_LOGGED_OUT_PREFERENCES: UsePreferencesQueryResponse = { moderationPrefs: { adultContentEnabled: false, labels: DEFAULT_LOGGED_OUT_LABEL_PREFERENCES, - mods: [], + labelers: [], }, feedViewPrefs: DEFAULT_HOME_FEED_PREFS, threadViewPrefs: DEFAULT_THREAD_VIEW_PREFS, diff --git a/src/state/queries/preferences/moderation.ts b/src/state/queries/preferences/moderation.ts index 6400aa7caa..f7a5637984 100644 --- a/src/state/queries/preferences/moderation.ts +++ b/src/state/queries/preferences/moderation.ts @@ -17,7 +17,7 @@ export const DEFAULT_LOGGED_OUT_LABEL_PREFERENCES: typeof DEFAULT_LABEL_SETTINGS export function useMyLabelers() { const prefs = usePreferencesQuery() - const dids = prefs.data?.moderationPrefs.mods.map(m => m.did) || [] + const dids = prefs.data?.moderationPrefs.labelers.map(l => l.did) || [] if (!dids.includes(BSKY_LABELER_DID)) { dids.push(BSKY_LABELER_DID) } diff --git a/src/view/screens/DebugMod.tsx b/src/view/screens/DebugMod.tsx index 5bff83a462..43f55824d1 100644 --- a/src/view/screens/DebugMod.tsx +++ b/src/view/screens/DebugMod.tsx @@ -64,6 +64,7 @@ export const DebugModScreen = ({}: NativeStackScreenProps< identifier: 'custom', blurs: 'content', severity: 'alert', + defaultSetting: 'warn', locales: [ { lang: 'en', @@ -235,7 +236,7 @@ export const DebugModScreen = ({}: NativeStackScreenProps< labels: { [label[0]]: visibility[0] as LabelPreference, }, - mods: [ + labelers: [ { did: 'did:plc:fake-labeler', labels: {[label[0]]: visibility[0] as LabelPreference},