Add (WIP) debug mod page

This commit is contained in:
Paul Frazee
2024-02-07 21:26:28 -08:00
parent 270476a126
commit 15d0f2e90b
14 changed files with 523 additions and 17 deletions
+16 -1
View File
@@ -17,6 +17,7 @@ export interface ModerationCauseDescription {
export function describeModerationCause(
cause: ModerationCause | undefined,
context: 'account' | 'content',
labelStrings: LabelStrings,
): ModerationCauseDescription {
// TODO localize
if (!cause) {
@@ -77,7 +78,21 @@ export function describeModerationCause(
description: `You have hidden this post`,
}
}
return cause.labelDef.strings[context].en
if (cause.labelDef.id in labelStrings) {
const strings = labelStrings[cause.labelDef.id as keyof typeof LABELS]
return {
name: context === 'account' ? strings.account.name : strings.content.name,
description:
context === 'account'
? strings.account.description
: strings.content.description,
}
}
return {
name: 'TODO',
description: `TODo`,
}
// return cause.labelDef.strings[context].en
}
export function getProfileModerationCauses(
+1
View File
@@ -23,6 +23,7 @@ export type CommonNavigatorParams = {
ProfileFeedLikedBy: {name: string; rkey: string}
ProfileModservice: {name: string}
Debug: undefined
DebugMod: undefined
Log: undefined
Support: undefined
PrivacyPolicy: undefined
+1 -2
View File
@@ -1,5 +1,4 @@
import {ModerationUI} from '@atproto/api'
import {describeModerationCause} from '../moderation'
// \u2705 = ✅
// \u2713 = ✓
@@ -14,7 +13,7 @@ export function sanitizeDisplayName(
moderation?: ModerationUI,
): string {
if (moderation?.blur) {
return `${describeModerationCause(moderation.cause, 'account').name}`
return ` Display name hidden`
}
if (typeof str === 'string') {
return str.replace(CHECK_MARKS_RE, '').replace(CONTROL_CHARS_RE, '').trim()