Adjust sorting, return type, integrate feedback

This commit is contained in:
Eric Bailey
2025-10-08 21:09:48 -05:00
parent 74d12fbacc
commit 810a1d8b33
4 changed files with 242 additions and 242 deletions
@@ -36,11 +36,11 @@ export function useSubmitReportMutation() {
const labelerSupportedReasonTypes = labeler.reasonTypes || [] const labelerSupportedReasonTypes = labeler.reasonTypes || []
let reasonType = state.selectedOption.reason let reasonType = state.selectedOption.reason
const backwardsCompatableReasonType = NEW_TO_OLD_REASONS_MAP[reasonType] const backwardsCompatibleReasonType = NEW_TO_OLD_REASONS_MAP[reasonType]
const supportsNewReasonType = const supportsNewReasonType =
labelerSupportedReasonTypes.includes(reasonType) labelerSupportedReasonTypes.includes(reasonType)
const supportsOldReasonType = labelerSupportedReasonTypes.includes( const supportsOldReasonType = labelerSupportedReasonTypes.includes(
backwardsCompatableReasonType, backwardsCompatibleReasonType,
) )
/* /*
@@ -49,7 +49,7 @@ export function useSubmitReportMutation() {
* supported reason types, send the new version. * supported reason types, send the new version.
*/ */
if (supportsOldReasonType && !supportsNewReasonType) { if (supportsOldReasonType && !supportsNewReasonType) {
reasonType = backwardsCompatableReasonType reasonType = backwardsCompatibleReasonType
} }
let report: let report:
@@ -99,7 +99,7 @@ export const OTHER_REPORT_REASONS: Set<OzoneReportDefs.ReasonType> = new Set([
]) ])
/** /**
* Set of report reasons that should only be sent Bluesky's moderation service. * Set of report reasons that should only be sent to Bluesky's moderation service.
*/ */
export const BSKY_LABELER_ONLY_REPORT_REASONS: Set<OzoneReportDefs.ReasonType> = export const BSKY_LABELER_ONLY_REPORT_REASONS: Set<OzoneReportDefs.ReasonType> =
new Set([ new Set([
@@ -103,7 +103,7 @@ function Inner(props: ReportDialogProps) {
} = useMyLabelersQuery({excludeNonConfigurableLabelers: true}) } = useMyLabelersQuery({excludeNonConfigurableLabelers: true})
const isLoading = useDelayedLoading(500, isLabelerLoading) const isLoading = useDelayedLoading(500, isLabelerLoading)
const copy = useCopyForSubject(props.subject) const copy = useCopyForSubject(props.subject)
const {sortedCategories, getCategory} = useReportOptions() const {categories, getCategory} = useReportOptions()
const [state, dispatch] = React.useReducer(reducer, initialState) const [state, dispatch] = React.useReducer(reducer, initialState)
/** /**
@@ -274,7 +274,7 @@ function Inner(props: ReportDialogProps) {
</View> </View>
) : ( ) : (
<View style={[a.gap_sm]}> <View style={[a.gap_sm]}>
{sortedCategories.map(o => ( {categories.map(o => (
<CategoryCard <CategoryCard
key={o.key} key={o.key}
option={o} option={o}
@@ -1,3 +1,4 @@
import {useMemo} from 'react'
import * as OzoneReportDefs from '@atproto/api/dist/client/types/tools/ozone/report/defs' import * as OzoneReportDefs from '@atproto/api/dist/client/types/tools/ozone/report/defs'
import {msg} from '@lingui/macro' import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react' import {useLingui} from '@lingui/react'
@@ -29,241 +30,240 @@ export type ReportOption = {
export function useReportOptions() { export function useReportOptions() {
const {_} = useLingui() const {_} = useLingui()
const categories: Record<ReportCategory, ReportCategoryConfig> = { return useMemo(() => {
childSafety: { const categories: Record<ReportCategory, ReportCategoryConfig> = {
key: 'childSafety', misleading: {
title: _(msg`Child safety`), key: 'misleading',
description: _( title: _(msg`Misleading`),
msg`Content harming or endangering minors' safety and wellbeing`, description: _(msg`Spam, scams, bots, false info, or impersonation`),
), sort: 5,
sort: 1, options: [
options: [ {
{ title: _(msg`Spam`),
title: _(msg`Child Sexual Abuse Material (CSAM)`), reason: OzoneReportDefs.REASONMISLEADINGSPAM,
reason: OzoneReportDefs.REASONCHILDSAFETYCSAM, },
}, {
{ title: _(msg`Scam`),
title: _(msg`Grooming or predatory behavior`), reason: OzoneReportDefs.REASONMISLEADINGSCAM,
reason: OzoneReportDefs.REASONCHILDSAFETYGROOM, },
}, {
{ title: _(msg`Fake account or bot`),
title: _(msg`Privacy violation of a minor`), reason: OzoneReportDefs.REASONMISLEADINGBOT,
reason: OzoneReportDefs.REASONCHILDSAFETYPRIVACY, },
}, {
{ title: _(msg`Impersonation`),
title: _(msg`Minor harassment or bullying`), reason: OzoneReportDefs.REASONMISLEADINGIMPERSONATION,
reason: OzoneReportDefs.REASONCHILDSAFETYHARASSMENT, },
}, {
{ title: _(msg`False information about elections`),
title: _(msg`Other child safety issue`), reason: OzoneReportDefs.REASONMISLEADINGELECTIONS,
reason: OzoneReportDefs.REASONCHILDSAFETYOTHER, },
}, {
], title: _(msg`Other misleading content`),
}, reason: OzoneReportDefs.REASONMISLEADINGOTHER,
violencePhysicalHarm: { },
key: 'violencePhysicalHarm', ],
title: _(msg`Violence or physical harm`), },
sort: 2, sexualAdultContent: {
description: _(msg`Threats, calls for violence, or graphic content`), key: 'sexualAdultContent',
options: [ title: _(msg`Sexual and adult content`),
{ description: _(msg`Adult, child or animal sexual abuse`),
title: _(msg`Animal welfare`), sort: 3,
reason: OzoneReportDefs.REASONVIOLENCEANIMAL, options: [
}, {
{ title: _(msg`Unlabeled adult content`),
title: _(msg`Threats or incitement`), reason: OzoneReportDefs.REASONSEXUALUNLABELED,
reason: OzoneReportDefs.REASONVIOLENCETHREATS, },
}, {
{ title: _(msg`Adult sexual abuse content`),
title: _(msg`Graphic violent content`), reason: OzoneReportDefs.REASONSEXUALABUSECONTENT,
reason: OzoneReportDefs.REASONVIOLENCEGRAPHICCONTENT, },
}, {
{ title: _(msg`Non-consensual intimate imagery`),
title: _(msg`Glorification of violence`), reason: OzoneReportDefs.REASONSEXUALNCII,
reason: OzoneReportDefs.REASONVIOLENCEGLORIFICATION, },
}, {
{ title: _(msg`Deepfake adult content`),
title: _(msg`Extremist content`), reason: OzoneReportDefs.REASONSEXUALDEEPFAKE,
reason: OzoneReportDefs.REASONVIOLENCEEXTREMISTCONTENT, },
}, {
{ title: _(msg`Animal sexual abuse`),
title: _(msg`Human trafficking`), reason: OzoneReportDefs.REASONSEXUALANIMAL,
reason: OzoneReportDefs.REASONVIOLENCETRAFFICKING, },
}, {
{ title: _(msg`Other sexual violence content`),
title: _(msg`Other violent content`), reason: OzoneReportDefs.REASONSEXUALOTHER,
reason: OzoneReportDefs.REASONVIOLENCEOTHER, },
}, ],
], },
}, harassmentHate: {
sexualAdultContent: { key: 'harassmentHate',
key: 'sexualAdultContent', title: _(msg`Harassment or hate`),
title: _(msg`Sexual and adult content`), description: _(
description: _(msg`Adult, child or animal sexual abuse`), msg`Targeted attacks, hate speech, or organized harassment`,
sort: 3, ),
options: [ sort: 4,
{ options: [
title: _(msg`Adult sexual abuse content`), {
reason: OzoneReportDefs.REASONSEXUALABUSECONTENT, title: _(msg`Trolling`),
}, reason: OzoneReportDefs.REASONHARASSMENTTROLL,
{ },
title: _(msg`Non-consensual intimate imagery`), {
reason: OzoneReportDefs.REASONSEXUALNCII, title: _(msg`Targeted harassment`),
}, reason: OzoneReportDefs.REASONHARASSMENTTARGETED,
{ },
title: _(msg`Deepfake adult content`), {
reason: OzoneReportDefs.REASONSEXUALDEEPFAKE, title: _(msg`Hate speech`),
}, reason: OzoneReportDefs.REASONHARASSMENTHATESPEECH,
{ },
title: _(msg`Animal sexual abuse`), {
reason: OzoneReportDefs.REASONSEXUALANIMAL, title: _(msg`Doxxing`),
}, reason: OzoneReportDefs.REASONHARASSMENTDOXXING,
{ },
title: _(msg`Unlabeled adult content`), {
reason: OzoneReportDefs.REASONSEXUALUNLABELED, title: _(msg`Other harassing or hateful content`),
}, reason: OzoneReportDefs.REASONHARASSMENTOTHER,
{ },
title: _(msg`Other sexual violence content`), ],
reason: OzoneReportDefs.REASONSEXUALOTHER, },
}, childSafety: {
], key: 'childSafety',
}, title: _(msg`Child safety`),
harassmentHate: { description: _(
key: 'harassmentHate', msg`Content harming or endangering minors' safety and wellbeing`,
title: _(msg`Harassment or hate`), ),
description: _( sort: 1,
msg`Targeted attacks, hate speech, or organized harassment`, options: [
), {
sort: 4, title: _(msg`Child Sexual Abuse Material (CSAM)`),
options: [ reason: OzoneReportDefs.REASONCHILDSAFETYCSAM,
{ },
title: _(msg`Trolling`), {
reason: OzoneReportDefs.REASONHARASSMENTTROLL, title: _(msg`Grooming or predatory behavior`),
}, reason: OzoneReportDefs.REASONCHILDSAFETYGROOM,
{ },
title: _(msg`Targeted harassment`), {
reason: OzoneReportDefs.REASONHARASSMENTTARGETED, title: _(msg`Privacy violation of a minor`),
}, reason: OzoneReportDefs.REASONCHILDSAFETYPRIVACY,
{ },
title: _(msg`Hate speech`), {
reason: OzoneReportDefs.REASONHARASSMENTHATESPEECH, title: _(msg`Minor harassment or bullying`),
}, reason: OzoneReportDefs.REASONCHILDSAFETYHARASSMENT,
{ },
title: _(msg`Doxxing`), {
reason: OzoneReportDefs.REASONHARASSMENTDOXXING, title: _(msg`Other child safety issue`),
}, reason: OzoneReportDefs.REASONCHILDSAFETYOTHER,
{ },
title: _(msg`Other harassing or hateful content`), ],
reason: OzoneReportDefs.REASONHARASSMENTOTHER, },
}, violencePhysicalHarm: {
], key: 'violencePhysicalHarm',
}, title: _(msg`Violence or physical harm`),
misleading: { sort: 2,
key: 'misleading', description: _(msg`Threats, calls for violence, or graphic content`),
title: _(msg`Misleading`), options: [
description: _(msg`Spam, scams, bots, false info, or impersonation`), {
sort: 5, title: _(msg`Animal welfare`),
options: [ reason: OzoneReportDefs.REASONVIOLENCEANIMAL,
{ },
title: _(msg`Fake account or bot`), {
reason: OzoneReportDefs.REASONMISLEADINGBOT, title: _(msg`Threats or incitement`),
}, reason: OzoneReportDefs.REASONVIOLENCETHREATS,
{ },
title: _(msg`Impersonation`), {
reason: OzoneReportDefs.REASONMISLEADINGIMPERSONATION, title: _(msg`Graphic violent content`),
}, reason: OzoneReportDefs.REASONVIOLENCEGRAPHICCONTENT,
{ },
title: _(msg`Spam`), {
reason: OzoneReportDefs.REASONMISLEADINGSPAM, title: _(msg`Glorification of violence`),
}, reason: OzoneReportDefs.REASONVIOLENCEGLORIFICATION,
{ },
title: _(msg`Scam`), {
reason: OzoneReportDefs.REASONMISLEADINGSCAM, title: _(msg`Extremist content`),
}, reason: OzoneReportDefs.REASONVIOLENCEEXTREMISTCONTENT,
{ },
title: _(msg`False information about elections`), {
reason: OzoneReportDefs.REASONMISLEADINGELECTIONS, title: _(msg`Human trafficking`),
}, reason: OzoneReportDefs.REASONVIOLENCETRAFFICKING,
{ },
title: _(msg`Other misleading content`), {
reason: OzoneReportDefs.REASONMISLEADINGOTHER, title: _(msg`Other violent content`),
}, reason: OzoneReportDefs.REASONVIOLENCEOTHER,
], },
}, ],
ruleBreaking: { },
key: 'ruleBreaking', selfHarm: {
title: _(msg`Breaking network rules`), key: 'selfHarm',
description: _(msg`Hacking, stolen content, or prohibited sales`), title: _(msg`Self-harm`),
sort: 6, description: _(msg`Harmful or high-risk activities`),
options: [ sort: 7,
{ options: [
title: _(msg`Hacking or system attacks`), {
reason: OzoneReportDefs.REASONRULESITESECURITY, title: _(msg`Content promoting or depicting self-harm`),
}, reason: OzoneReportDefs.REASONSELFHARMCONTENT,
{ },
title: _(msg`Promoting or selling prohibited items or services`), {
reason: OzoneReportDefs.REASONRULEPROHIBITEDSALES, title: _(msg`Eating disorders`),
}, reason: OzoneReportDefs.REASONSELFHARMED,
{ },
title: _(msg`Banned user returning`), {
reason: OzoneReportDefs.REASONRULEBANEVASION, title: _(msg`Dangerous challenges or activities`),
}, reason: OzoneReportDefs.REASONSELFHARMSTUNTS,
{ },
title: _(msg`Other network rule-breaking`), {
reason: OzoneReportDefs.REASONRULEOTHER, title: _(msg`Dangerous substances or drug abuse`),
}, reason: OzoneReportDefs.REASONSELFHARMSUBSTANCES,
], },
}, {
selfHarm: { title: _(msg`Other dangerous content`),
key: 'selfHarm', reason: OzoneReportDefs.REASONSELFHARMOTHER,
title: _(msg`Self-harm`), },
description: _(msg`Harmful or high-risk activities`), ],
sort: 7, },
options: [ ruleBreaking: {
{ key: 'ruleBreaking',
title: _(msg`Content promoting or depicting self-harm`), title: _(msg`Breaking network rules`),
reason: OzoneReportDefs.REASONSELFHARMCONTENT, description: _(msg`Hacking, stolen content, or prohibited sales`),
}, sort: 6,
{ options: [
title: _(msg`Eating disorders`), {
reason: OzoneReportDefs.REASONSELFHARMED, title: _(msg`Hacking or system attacks`),
}, reason: OzoneReportDefs.REASONRULESITESECURITY,
{ },
title: _(msg`Dangerous challenges or activities`), {
reason: OzoneReportDefs.REASONSELFHARMSTUNTS, title: _(msg`Promoting or selling prohibited items or services`),
}, reason: OzoneReportDefs.REASONRULEPROHIBITEDSALES,
{ },
title: _(msg`Dangerous substances or drug abuse`), {
reason: OzoneReportDefs.REASONSELFHARMSUBSTANCES, title: _(msg`Banned user returning`),
}, reason: OzoneReportDefs.REASONRULEBANEVASION,
{ },
title: _(msg`Other dangerous content`), {
reason: OzoneReportDefs.REASONSELFHARMOTHER, title: _(msg`Other network rule-breaking`),
}, reason: OzoneReportDefs.REASONRULEOTHER,
], },
}, ],
other: { },
key: 'other', other: {
title: _(msg`Other`), key: 'other',
description: _(msg`An issue not included in these options`), title: _(msg`Other`),
sort: 8, description: _(msg`An issue not included in these options`),
options: [ sort: 8,
{ options: [
title: _(msg`Other`), {
reason: OzoneReportDefs.REASONOTHER, title: _(msg`Other`),
}, reason: OzoneReportDefs.REASONOTHER,
], },
isOther: true, ],
}, isOther: true,
} },
}
const sortedCategories = ( return {
Object.values(categories) as ReportCategoryConfig[] categories: Object.values(categories) as ReportCategoryConfig[],
).sort((a, b) => a.sort - b.sort) getCategory(reasonName: ReportCategory) {
return categories[reasonName]
const getCategory = (reasonName: ReportCategory) => { },
return categories[reasonName] }
} }, [_])
return {categories, sortedCategories, getCategory}
} }