moderation action 'escalate' type ()

* lex: 'escalate' mod action type

* api: codegen for escalate mod action type

* pds: codegen+impl esclate mod action type

* bsky: codegen+impl esclate mod action type

* pds: prettier:fix

* Tidy

---------

Co-authored-by: Devin Ivy <devinivy@gmail.com>
This commit is contained in:
bnewbold 2023-05-04 12:32:27 -07:00 committed by GitHub
parent b75436b9cb
commit 8c19ce991a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 59 additions and 5 deletions
lexicons/com/atproto/admin
packages
api/src/client
index.tslexicons.ts
types/com/atproto/admin
bsky/src
api/com/atproto/moderation
db/tables
lexicon
index.tslexicons.ts
types
app/bsky/unspecced
com/atproto/admin
pds/src
api/com/atproto/moderation
db/tables
lexicon
index.tslexicons.ts
types/com/atproto/admin

@ -70,7 +70,8 @@
"knownValues": [
"#takedown",
"#flag",
"#acknowledge"
"#acknowledge",
"#escalate"
]
},
"takedown": {
@ -85,6 +86,10 @@
"type": "token",
"description": "Moderation action type: Acknowledge. Indicates that the content was reviewed and not considered to violate PDS rules."
},
"escalate": {
"type": "token",
"description": "Moderation action type: Escalate. Indicates that the content has been flagged for additional review."
},
"reportView": {
"type": "object",
"required": ["id", "reasonType", "subject", "reportedBy", "createdAt", "resolvedByActionIds"],

@ -201,6 +201,7 @@ export const COM_ATPROTO_ADMIN = {
DefsTakedown: 'com.atproto.admin.defs#takedown',
DefsFlag: 'com.atproto.admin.defs#flag',
DefsAcknowledge: 'com.atproto.admin.defs#acknowledge',
DefsEscalate: 'com.atproto.admin.defs#escalate',
}
export const COM_ATPROTO_MODERATION = {
DefsReasonSpam: 'com.atproto.moderation.defs#reasonSpam',

@ -182,6 +182,7 @@ export const schemaDict = {
'lex:com.atproto.admin.defs#takedown',
'lex:com.atproto.admin.defs#flag',
'lex:com.atproto.admin.defs#acknowledge',
'lex:com.atproto.admin.defs#escalate',
],
},
takedown: {
@ -199,6 +200,11 @@ export const schemaDict = {
description:
'Moderation action type: Acknowledge. Indicates that the content was reviewed and not considered to violate PDS rules.',
},
escalate: {
type: 'token',
description:
'Moderation action type: Escalate. Indicates that the content has been flagged for additional review.',
},
reportView: {
type: 'object',
required: [

@ -108,6 +108,7 @@ export type ActionType =
| 'lex:com.atproto.admin.defs#takedown'
| 'lex:com.atproto.admin.defs#flag'
| 'lex:com.atproto.admin.defs#acknowledge'
| 'lex:com.atproto.admin.defs#escalate'
| (string & {})
/** Moderation action type: Takedown. Indicates that content should not be served by the PDS. */
@ -116,6 +117,8 @@ export const TAKEDOWN = 'com.atproto.admin.defs#takedown'
export const FLAG = 'com.atproto.admin.defs#flag'
/** Moderation action type: Acknowledge. Indicates that the content was reviewed and not considered to violate PDS rules. */
export const ACKNOWLEDGE = 'com.atproto.admin.defs#acknowledge'
/** Moderation action type: Escalate. Indicates that the content has been flagged for additional review. */
export const ESCALATE = 'com.atproto.admin.defs#escalate'
export interface ReportView {
id: number

@ -9,6 +9,7 @@ import {
ACKNOWLEDGE,
FLAG,
TAKEDOWN,
ESCALATE,
} from '../../../../lexicon/types/com/atproto/admin/defs'
import {
REASONOTHER,
@ -49,7 +50,12 @@ export const getReasonType = (reasonType: ReportInput['reasonType']) => {
}
export const getAction = (action: ActionInput['action']) => {
if (action === TAKEDOWN || action === FLAG || action === ACKNOWLEDGE) {
if (
action === TAKEDOWN ||
action === FLAG ||
action === ACKNOWLEDGE ||
action === ESCALATE
) {
return action as ModerationAction['action']
}
throw new InvalidRequestError('Invalid action')

@ -3,6 +3,7 @@ import {
ACKNOWLEDGE,
FLAG,
TAKEDOWN,
ESCALATE,
} from '../../lexicon/types/com/atproto/admin/defs'
import {
REASONOTHER,
@ -20,7 +21,7 @@ export const reportResolutionTableName = 'moderation_report_resolution'
export interface ModerationAction {
id: Generated<number>
action: typeof TAKEDOWN | typeof FLAG | typeof ACKNOWLEDGE
action: typeof TAKEDOWN | typeof FLAG | typeof ACKNOWLEDGE | typeof ESCALATE
subjectType: 'com.atproto.admin.defs#repoRef' | 'com.atproto.repo.strongRef'
subjectDid: string
subjectUri: string | null

@ -90,6 +90,7 @@ export const COM_ATPROTO_ADMIN = {
DefsTakedown: 'com.atproto.admin.defs#takedown',
DefsFlag: 'com.atproto.admin.defs#flag',
DefsAcknowledge: 'com.atproto.admin.defs#acknowledge',
DefsEscalate: 'com.atproto.admin.defs#escalate',
}
export const COM_ATPROTO_MODERATION = {
DefsReasonSpam: 'com.atproto.moderation.defs#reasonSpam',

@ -182,6 +182,7 @@ export const schemaDict = {
'lex:com.atproto.admin.defs#takedown',
'lex:com.atproto.admin.defs#flag',
'lex:com.atproto.admin.defs#acknowledge',
'lex:com.atproto.admin.defs#escalate',
],
},
takedown: {
@ -199,6 +200,11 @@ export const schemaDict = {
description:
'Moderation action type: Acknowledge. Indicates that the content was reviewed and not considered to violate PDS rules.',
},
escalate: {
type: 'token',
description:
'Moderation action type: Escalate. Indicates that the content has been flagged for additional review.',
},
reportView: {
type: 'object',
required: [
@ -5076,6 +5082,10 @@ export const schemaDict = {
parameters: {
type: 'params',
properties: {
includeNsfw: {
type: 'boolean',
default: false,
},
limit: {
type: 'integer',
minimum: 1,

@ -10,6 +10,7 @@ import { HandlerAuth } from '@atproto/xrpc-server'
import * as AppBskyFeedDefs from '../feed/defs'
export interface QueryParams {
includeNsfw: boolean
limit: number
cursor?: string
}

@ -108,6 +108,7 @@ export type ActionType =
| 'lex:com.atproto.admin.defs#takedown'
| 'lex:com.atproto.admin.defs#flag'
| 'lex:com.atproto.admin.defs#acknowledge'
| 'lex:com.atproto.admin.defs#escalate'
| (string & {})
/** Moderation action type: Takedown. Indicates that content should not be served by the PDS. */
@ -116,6 +117,8 @@ export const TAKEDOWN = 'com.atproto.admin.defs#takedown'
export const FLAG = 'com.atproto.admin.defs#flag'
/** Moderation action type: Acknowledge. Indicates that the content was reviewed and not considered to violate PDS rules. */
export const ACKNOWLEDGE = 'com.atproto.admin.defs#acknowledge'
/** Moderation action type: Escalate. Indicates that the content has been flagged for additional review. */
export const ESCALATE = 'com.atproto.admin.defs#escalate'
export interface ReportView {
id: number

@ -8,6 +8,7 @@ import {
ACKNOWLEDGE,
FLAG,
TAKEDOWN,
ESCALATE,
} from '../../../../lexicon/types/com/atproto/admin/defs'
import {
REASONOTHER,
@ -49,7 +50,12 @@ export const getReasonType = (reasonType: ReportInput['reasonType']) => {
}
export const getAction = (action: ActionInput['action']) => {
if (action === TAKEDOWN || action === FLAG || action === ACKNOWLEDGE) {
if (
action === TAKEDOWN ||
action === FLAG ||
action === ACKNOWLEDGE ||
action === ESCALATE
) {
return action as ModerationAction['action']
}
throw new InvalidRequestError('Invalid action')

@ -3,6 +3,7 @@ import {
ACKNOWLEDGE,
FLAG,
TAKEDOWN,
ESCALATE,
} from '../../lexicon/types/com/atproto/admin/defs'
import {
REASONOTHER,
@ -20,7 +21,7 @@ export const reportResolutionTableName = 'moderation_report_resolution'
export interface ModerationAction {
id: Generated<number>
action: typeof TAKEDOWN | typeof FLAG | typeof ACKNOWLEDGE
action: typeof TAKEDOWN | typeof FLAG | typeof ACKNOWLEDGE | typeof ESCALATE
subjectType: 'com.atproto.admin.defs#repoRef' | 'com.atproto.repo.strongRef'
subjectDid: string
subjectUri: string | null

@ -90,6 +90,7 @@ export const COM_ATPROTO_ADMIN = {
DefsTakedown: 'com.atproto.admin.defs#takedown',
DefsFlag: 'com.atproto.admin.defs#flag',
DefsAcknowledge: 'com.atproto.admin.defs#acknowledge',
DefsEscalate: 'com.atproto.admin.defs#escalate',
}
export const COM_ATPROTO_MODERATION = {
DefsReasonSpam: 'com.atproto.moderation.defs#reasonSpam',

@ -182,6 +182,7 @@ export const schemaDict = {
'lex:com.atproto.admin.defs#takedown',
'lex:com.atproto.admin.defs#flag',
'lex:com.atproto.admin.defs#acknowledge',
'lex:com.atproto.admin.defs#escalate',
],
},
takedown: {
@ -199,6 +200,11 @@ export const schemaDict = {
description:
'Moderation action type: Acknowledge. Indicates that the content was reviewed and not considered to violate PDS rules.',
},
escalate: {
type: 'token',
description:
'Moderation action type: Escalate. Indicates that the content has been flagged for additional review.',
},
reportView: {
type: 'object',
required: [

@ -108,6 +108,7 @@ export type ActionType =
| 'lex:com.atproto.admin.defs#takedown'
| 'lex:com.atproto.admin.defs#flag'
| 'lex:com.atproto.admin.defs#acknowledge'
| 'lex:com.atproto.admin.defs#escalate'
| (string & {})
/** Moderation action type: Takedown. Indicates that content should not be served by the PDS. */
@ -116,6 +117,8 @@ export const TAKEDOWN = 'com.atproto.admin.defs#takedown'
export const FLAG = 'com.atproto.admin.defs#flag'
/** Moderation action type: Acknowledge. Indicates that the content was reviewed and not considered to violate PDS rules. */
export const ACKNOWLEDGE = 'com.atproto.admin.defs#acknowledge'
/** Moderation action type: Escalate. Indicates that the content has been flagged for additional review. */
export const ESCALATE = 'com.atproto.admin.defs#escalate'
export interface ReportView {
id: number