From fef171df5cd5ca82a22cacd265285314ba643aac Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Tue, 11 Nov 2025 11:55:03 -0600 Subject: [PATCH] Migrate remaining old report reasons, remove old unused file --- .../ageAssurance/AgeAssuranceAppealDialog.tsx | 4 +- .../moderation/LabelsOnMeDialog.tsx | 4 +- src/lib/moderation/useReportOptions.ts | 122 ------------------ .../Messages/components/ChatDisabled.tsx | 4 +- src/screens/Takendown.tsx | 4 +- 5 files changed, 8 insertions(+), 130 deletions(-) delete mode 100644 src/lib/moderation/useReportOptions.ts diff --git a/src/components/ageAssurance/AgeAssuranceAppealDialog.tsx b/src/components/ageAssurance/AgeAssuranceAppealDialog.tsx index a63c348fbd..9fbe0c428d 100644 --- a/src/components/ageAssurance/AgeAssuranceAppealDialog.tsx +++ b/src/components/ageAssurance/AgeAssuranceAppealDialog.tsx @@ -1,6 +1,6 @@ import React from 'react' import {View} from 'react-native' -import {ComAtprotoModerationDefs} from '@atproto/api' +import {ToolsOzoneReportDefs} from '@atproto/api' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {useMutation} from '@tanstack/react-query' @@ -50,7 +50,7 @@ function Inner({control}: {control: Dialog.DialogControlProps}) { await agent.createModerationReport( { - reasonType: ComAtprotoModerationDefs.REASONAPPEAL, + reasonType: ToolsOzoneReportDefs.REASONAPPEAL, subject: { $type: 'com.atproto.admin.defs#repoRef', did: currentAccount?.did, diff --git a/src/components/moderation/LabelsOnMeDialog.tsx b/src/components/moderation/LabelsOnMeDialog.tsx index ceee4cf9dc..2e1bd5d557 100644 --- a/src/components/moderation/LabelsOnMeDialog.tsx +++ b/src/components/moderation/LabelsOnMeDialog.tsx @@ -1,6 +1,6 @@ import React, {useState} from 'react' import {View} from 'react-native' -import {type ComAtprotoLabelDefs, ComAtprotoModerationDefs} from '@atproto/api' +import {type ComAtprotoLabelDefs, ToolsOzoneReportDefs} from '@atproto/api' import {XRPCError} from '@atproto/xrpc' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' @@ -239,7 +239,7 @@ function AppealForm({ : 'com.atproto.admin.defs#repoRef' await agent.createModerationReport( { - reasonType: ComAtprotoModerationDefs.REASONAPPEAL, + reasonType: ToolsOzoneReportDefs.REASONAPPEAL, subject: { $type, ...subject, diff --git a/src/lib/moderation/useReportOptions.ts b/src/lib/moderation/useReportOptions.ts deleted file mode 100644 index ecf38ed779..0000000000 --- a/src/lib/moderation/useReportOptions.ts +++ /dev/null @@ -1,122 +0,0 @@ -import {useMemo} from 'react' -import {ComAtprotoModerationDefs} from '@atproto/api' -import {msg} from '@lingui/macro' -import {useLingui} from '@lingui/react' - -export interface ReportOption { - reason: string - title: string - description: string -} - -interface ReportOptions { - account: ReportOption[] - post: ReportOption[] - list: ReportOption[] - starterpack: ReportOption[] - feedgen: ReportOption[] - other: ReportOption[] - convoMessage: ReportOption[] -} - -export function useReportOptions(): ReportOptions { - const {_} = useLingui() - return useMemo(() => { - const other = { - reason: ComAtprotoModerationDefs.REASONOTHER, - title: _(msg`Other`), - description: _(msg`An issue not included in these options`), - } - const common = [ - { - reason: ComAtprotoModerationDefs.REASONRUDE, - title: _(msg`Anti-Social Behavior`), - description: _(msg`Harassment, trolling, or intolerance`), - }, - { - reason: ComAtprotoModerationDefs.REASONVIOLATION, - title: _(msg`Illegal and Urgent`), - description: _(msg`Glaring violations of law or terms of service`), - }, - other, - ] - return { - account: [ - { - reason: ComAtprotoModerationDefs.REASONMISLEADING, - title: _(msg`Misleading Account`), - description: _( - msg`Impersonation or false claims about identity or affiliation`, - ), - }, - { - reason: ComAtprotoModerationDefs.REASONSPAM, - title: _(msg`Frequently Posts Unwanted Content`), - description: _(msg`Spam; excessive mentions or replies`), - }, - { - reason: ComAtprotoModerationDefs.REASONVIOLATION, - title: _(msg`Name or Description Violates Community Standards`), - description: _(msg`Terms used violate community standards`), - }, - other, - ], - post: [ - { - reason: ComAtprotoModerationDefs.REASONMISLEADING, - title: _(msg`Misleading Post`), - description: _(msg`Impersonation, misinformation, or false claims`), - }, - { - reason: ComAtprotoModerationDefs.REASONSPAM, - title: _(msg`Spam`), - description: _(msg`Excessive mentions or replies`), - }, - { - reason: ComAtprotoModerationDefs.REASONSEXUAL, - title: _(msg`Unwanted Sexual Content`), - description: _(msg`Nudity or adult content not labeled as such`), - }, - ...common, - ], - convoMessage: [ - { - reason: ComAtprotoModerationDefs.REASONSPAM, - title: _(msg`Spam`), - description: _(msg`Excessive or unwanted messages`), - }, - { - reason: ComAtprotoModerationDefs.REASONSEXUAL, - title: _(msg`Unwanted Sexual Content`), - description: _(msg`Inappropriate messages or explicit links`), - }, - ...common, - ], - list: [ - { - reason: ComAtprotoModerationDefs.REASONVIOLATION, - title: _(msg`Name or Description Violates Community Standards`), - description: _(msg`Terms used violate community standards`), - }, - ...common, - ], - starterpack: [ - { - reason: ComAtprotoModerationDefs.REASONVIOLATION, - title: _(msg`Name or Description Violates Community Standards`), - description: _(msg`Terms used violate community standards`), - }, - ...common, - ], - feedgen: [ - { - reason: ComAtprotoModerationDefs.REASONVIOLATION, - title: _(msg`Name or Description Violates Community Standards`), - description: _(msg`Terms used violate community standards`), - }, - ...common, - ], - other: common, - } - }, [_]) -} diff --git a/src/screens/Messages/components/ChatDisabled.tsx b/src/screens/Messages/components/ChatDisabled.tsx index 69abbab1a2..97fd35d708 100644 --- a/src/screens/Messages/components/ChatDisabled.tsx +++ b/src/screens/Messages/components/ChatDisabled.tsx @@ -1,6 +1,6 @@ import {useCallback, useState} from 'react' import {View} from 'react-native' -import {ComAtprotoModerationDefs} from '@atproto/api' +import {ToolsOzoneReportDefs} from '@atproto/api' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {useMutation} from '@tanstack/react-query' @@ -81,7 +81,7 @@ function DialogInner() { throw new Error('No current account, should be unreachable') await agent.createModerationReport( { - reasonType: ComAtprotoModerationDefs.REASONAPPEAL, + reasonType: ToolsOzoneReportDefs.REASONAPPEAL, subject: { $type: 'com.atproto.admin.defs#repoRef', did: currentAccount.did, diff --git a/src/screens/Takendown.tsx b/src/screens/Takendown.tsx index 8ba3de2fd3..dd319a4c62 100644 --- a/src/screens/Takendown.tsx +++ b/src/screens/Takendown.tsx @@ -3,7 +3,7 @@ import {Modal, View} from 'react-native' import {SystemBars} from 'react-native-edge-to-edge' import {KeyboardAwareScrollView} from 'react-native-keyboard-controller' import {useSafeAreaInsets} from 'react-native-safe-area-context' -import {type ComAtprotoAdminDefs, ComAtprotoModerationDefs} from '@atproto/api' +import {type ComAtprotoAdminDefs, ToolsOzoneReportDefs} from '@atproto/api' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {useMutation} from '@tanstack/react-query' @@ -54,7 +54,7 @@ export function Takendown() { if (!currentAccount) throw new Error('No session') await agent.com.atproto.moderation.createReport( { - reasonType: ComAtprotoModerationDefs.REASONAPPEAL, + reasonType: ToolsOzoneReportDefs.REASONAPPEAL, subject: { $type: 'com.atproto.admin.defs#repoRef', did: currentAccount.did,