[SDK] Swap moderation to @bsky.app/sdk and move labeler config to Client statics (#11383)
This commit is contained in:
@@ -5,7 +5,7 @@ import {
|
||||
View,
|
||||
type ViewStyle,
|
||||
} from 'react-native'
|
||||
import {type ModerationUI} from '@atproto/api'
|
||||
import {type ModerationUI} from '@bsky.app/sdk/moderation'
|
||||
import {Trans, useLingui} from '@lingui/react/macro'
|
||||
|
||||
import {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {createContext, useContext, useState} from 'react'
|
||||
import {type ModerationUI} from '@atproto/api'
|
||||
import {type ModerationUI} from '@bsky.app/sdk/moderation'
|
||||
|
||||
import {
|
||||
type ModerationCauseDescription,
|
||||
|
||||
@@ -2,7 +2,7 @@ import {View} from 'react-native'
|
||||
import {
|
||||
type InterpretedLabelValueDefinition,
|
||||
type LabelPreference,
|
||||
} from '@atproto/api'
|
||||
} from '@bsky.app/sdk/moderation'
|
||||
import {msg} from '@lingui/core/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
import {Trans} from '@lingui/react/macro'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {useState} from 'react'
|
||||
import {View} from 'react-native'
|
||||
import {type ModerationCause} from '@atproto/api'
|
||||
import {type ModerationCause} from '@bsky.app/sdk/moderation'
|
||||
import {msg} from '@lingui/core/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
import {Trans} from '@lingui/react/macro'
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import {type StyleProp, View, type ViewStyle} from 'react-native'
|
||||
import {
|
||||
type AppBskyFeedDefs,
|
||||
type ComAtprotoLabelDefs,
|
||||
type ModerationCause,
|
||||
type ModerationUI,
|
||||
} from '@atproto/api'
|
||||
import {type AppBskyFeedDefs, type ComAtprotoLabelDefs} from '@atproto/api'
|
||||
import {type ModerationCause, type ModerationUI} from '@bsky.app/sdk/moderation'
|
||||
import {plural} from '@lingui/core/macro'
|
||||
import {useLingui} from '@lingui/react/macro'
|
||||
|
||||
|
||||
@@ -7,11 +7,8 @@ import {
|
||||
View,
|
||||
type ViewStyle,
|
||||
} from 'react-native'
|
||||
import {
|
||||
type AppBskyActorDefs,
|
||||
type ModerationCause,
|
||||
type ModerationUI,
|
||||
} from '@atproto/api'
|
||||
import {type AppBskyActorDefs} from '@atproto/api'
|
||||
import {type ModerationCause, type ModerationUI} from '@bsky.app/sdk/moderation'
|
||||
import {msg} from '@lingui/core/macro'
|
||||
import {useLingui} from '@lingui/react'
|
||||
import {Trans} from '@lingui/react/macro'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {type StyleProp, type ViewStyle} from 'react-native'
|
||||
import {type ModerationDecision} from '@atproto/api'
|
||||
import {type ModerationDecision} from '@bsky.app/sdk/moderation'
|
||||
|
||||
import {getModerationCauseKey, unique} from '#/lib/moderation'
|
||||
import * as Pills from '#/components/Pills'
|
||||
|
||||
@@ -145,7 +145,7 @@ export function useSubmitReportMutation() {
|
||||
* the proxy target is built per call from that labeler's creator did.
|
||||
*/
|
||||
await client.call(com.atproto.moderation.createReport, report, {
|
||||
service: `${labeler.creator.did as DidString}#atproto_labeler`,
|
||||
service: `${labeler.creator.did}#atproto_labeler`,
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
useState,
|
||||
} from 'react'
|
||||
import {Pressable, type ScrollView, View} from 'react-native'
|
||||
import {type AppBskyLabelerDefs, BSKY_LABELER_DID} from '@atproto/api'
|
||||
import {BSKY_LABELER_DID} from '@atproto/api'
|
||||
import {Trans, useLingui} from '@lingui/react/macro'
|
||||
|
||||
import {wait} from '#/lib/async/wait'
|
||||
@@ -38,6 +38,7 @@ import {Loader} from '#/components/Loader'
|
||||
import {Text} from '#/components/Typography'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
import {IS_NATIVE} from '#/env'
|
||||
import {type app} from '#/lexicons'
|
||||
import {useSubmitReportMutation} from './action'
|
||||
import {
|
||||
BSKY_LABELER_ONLY_REPORT_REASONS,
|
||||
@@ -1045,8 +1046,8 @@ function LabelerCard({
|
||||
labeler,
|
||||
onSelect,
|
||||
}: {
|
||||
labeler: AppBskyLabelerDefs.LabelerViewDetailed
|
||||
onSelect?: (option: AppBskyLabelerDefs.LabelerViewDetailed) => void
|
||||
labeler: app.bsky.labeler.defs.LabelerViewDetailed
|
||||
onSelect?: (option: app.bsky.labeler.defs.LabelerViewDetailed) => void
|
||||
}) {
|
||||
const t = useTheme()
|
||||
const {t: l} = useLingui()
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import {
|
||||
type AppBskyLabelerDefs,
|
||||
ToolsOzoneReportDefs as OzoneReportDefs,
|
||||
} from '@atproto/api'
|
||||
import {ToolsOzoneReportDefs as OzoneReportDefs} from '@atproto/api'
|
||||
|
||||
import {type app} from '#/lexicons'
|
||||
import {
|
||||
getNciiQualificationOutcome,
|
||||
initialState,
|
||||
@@ -83,7 +81,7 @@ describe('reducer NCII qualification', () => {
|
||||
let state = selectNciiOption()
|
||||
state = reducer(state, {
|
||||
type: 'selectLabeler',
|
||||
labeler: {} as AppBskyLabelerDefs.LabelerViewDetailed,
|
||||
labeler: {} as app.bsky.labeler.defs.LabelerViewDetailed,
|
||||
})
|
||||
expect(state.activeStepIndex1).toBe(2)
|
||||
})
|
||||
@@ -92,7 +90,7 @@ describe('reducer NCII qualification', () => {
|
||||
let state = selectNciiOption()
|
||||
state = reducer(state, {
|
||||
type: 'selectLabeler',
|
||||
labeler: {} as AppBskyLabelerDefs.LabelerViewDetailed,
|
||||
labeler: {} as app.bsky.labeler.defs.LabelerViewDetailed,
|
||||
})
|
||||
state = reducer(state, {
|
||||
type: 'answerNciiQuestion',
|
||||
@@ -110,7 +108,7 @@ describe('reducer NCII qualification', () => {
|
||||
})
|
||||
|
||||
describe('reducer video timestamp', () => {
|
||||
const labeler = {} as AppBskyLabelerDefs.LabelerViewDetailed
|
||||
const labeler = {} as app.bsky.labeler.defs.LabelerViewDetailed
|
||||
const opted: ReportState = {...initialState, includeVideoTimestamp: true}
|
||||
|
||||
it('is off by default', () => {
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
import {
|
||||
type AppBskyLabelerDefs,
|
||||
ToolsOzoneReportDefs as OzoneReportDefs,
|
||||
} from '@atproto/api'
|
||||
import {ToolsOzoneReportDefs as OzoneReportDefs} from '@atproto/api'
|
||||
|
||||
import {OTHER_REPORT_REASONS} from '#/components/moderation/ReportDialog/const'
|
||||
import {
|
||||
type ReportCategoryConfig,
|
||||
type ReportOption,
|
||||
} from '#/components/moderation/ReportDialog/utils/useReportOptions'
|
||||
import {type app} from '#/lexicons'
|
||||
|
||||
export type NciiQualification = {
|
||||
isDepicted?: boolean
|
||||
@@ -16,7 +14,7 @@ export type NciiQualification = {
|
||||
export type ReportState = {
|
||||
selectedCategory?: ReportCategoryConfig
|
||||
selectedOption?: ReportOption
|
||||
selectedLabeler?: AppBskyLabelerDefs.LabelerViewDetailed
|
||||
selectedLabeler?: app.bsky.labeler.defs.LabelerViewDetailed
|
||||
details?: string
|
||||
detailsOpen: boolean
|
||||
activeStepIndex1: number
|
||||
@@ -71,7 +69,7 @@ export type ReportAction =
|
||||
}
|
||||
| {
|
||||
type: 'selectLabeler'
|
||||
labeler: AppBskyLabelerDefs.LabelerViewDetailed
|
||||
labeler: app.bsky.labeler.defs.LabelerViewDetailed
|
||||
}
|
||||
| {
|
||||
type: 'clearLabeler'
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
View,
|
||||
type ViewStyle,
|
||||
} from 'react-native'
|
||||
import {type ModerationUI} from '@atproto/api'
|
||||
import {type ModerationUI} from '@bsky.app/sdk/moderation'
|
||||
import {Trans, useLingui} from '@lingui/react/macro'
|
||||
import {useNavigation} from '@react-navigation/native'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user