Add (WIP) debug mod page
This commit is contained in:
+16
-1
@@ -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(
|
||||
|
||||
@@ -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,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()
|
||||
|
||||
Reference in New Issue
Block a user