diff --git a/.changeset/sharp-ducks-pump.md b/.changeset/sharp-ducks-pump.md new file mode 100644 index 00000000000..fb99138eafa --- /dev/null +++ b/.changeset/sharp-ducks-pump.md @@ -0,0 +1,5 @@ +--- +'@atproto/api': patch +--- + +Allow filtering for comment, label, report type and date range on queryModerationEvents endpoint. diff --git a/lexicons/com/atproto/admin/defs.json b/lexicons/com/atproto/admin/defs.json index 5a65ae31562..133deaf9383 100644 --- a/lexicons/com/atproto/admin/defs.json +++ b/lexicons/com/atproto/admin/defs.json @@ -33,7 +33,8 @@ "#modEventAcknowledge", "#modEventEscalate", "#modEventMute", - "#modEventEmail" + "#modEventEmail", + "#modEventResolveAppeal" ] }, "subject": { @@ -70,6 +71,7 @@ "#modEventAcknowledge", "#modEventEscalate", "#modEventMute", + "#modEventEmail", "#modEventResolveAppeal" ] }, diff --git a/lexicons/com/atproto/admin/queryModerationEvents.json b/lexicons/com/atproto/admin/queryModerationEvents.json index 70af1bf8ae5..887921cfe20 100644 --- a/lexicons/com/atproto/admin/queryModerationEvents.json +++ b/lexicons/com/atproto/admin/queryModerationEvents.json @@ -23,6 +23,16 @@ "enum": ["asc", "desc"], "description": "Sort direction for the events. Defaults to descending order of created at timestamp." }, + "createdAfter": { + "type": "string", + "format": "datetime", + "description": "Retrieve events created after a given timestamp" + }, + "createdBefore": { + "type": "string", + "format": "datetime", + "description": "Retrieve events created before a given timestamp" + }, "subject": { "type": "string", "format": "uri" }, "includeAllUserRecords": { "type": "boolean", @@ -35,6 +45,30 @@ "maximum": 100, "default": 50 }, + "hasComment": { + "type": "boolean", + "description": "If true, only events with comments are returned" + }, + "comment": { + "type": "string", + "description": "If specified, only events with comments containing the keyword are returned" + }, + "addedLabels": { + "type": "array", + "items": { "type": "string" }, + "description": "If specified, only events where all of these labels were added are returned" + }, + "removedLabels": { + "type": "array", + "items": { "type": "string" }, + "description": "If specified, only events where all of these labels were removed are returned" + }, + "reportTypes": { + "type": "array", + "items": { + "type": "string" + } + }, "cursor": { "type": "string" } } }, diff --git a/packages/api/src/client/lexicons.ts b/packages/api/src/client/lexicons.ts index 08a70f8ca1d..515098a8f49 100644 --- a/packages/api/src/client/lexicons.ts +++ b/packages/api/src/client/lexicons.ts @@ -91,6 +91,7 @@ export const schemaDict = { 'lex:com.atproto.admin.defs#modEventEscalate', 'lex:com.atproto.admin.defs#modEventMute', 'lex:com.atproto.admin.defs#modEventEmail', + 'lex:com.atproto.admin.defs#modEventResolveAppeal', ], }, subject: { @@ -147,6 +148,7 @@ export const schemaDict = { 'lex:com.atproto.admin.defs#modEventAcknowledge', 'lex:com.atproto.admin.defs#modEventEscalate', 'lex:com.atproto.admin.defs#modEventMute', + 'lex:com.atproto.admin.defs#modEventEmail', 'lex:com.atproto.admin.defs#modEventResolveAppeal', ], }, @@ -1450,6 +1452,16 @@ export const schemaDict = { description: 'Sort direction for the events. Defaults to descending order of created at timestamp.', }, + createdAfter: { + type: 'string', + format: 'datetime', + description: 'Retrieve events created after a given timestamp', + }, + createdBefore: { + type: 'string', + format: 'datetime', + description: 'Retrieve events created before a given timestamp', + }, subject: { type: 'string', format: 'uri', @@ -1466,6 +1478,37 @@ export const schemaDict = { maximum: 100, default: 50, }, + hasComment: { + type: 'boolean', + description: 'If true, only events with comments are returned', + }, + comment: { + type: 'string', + description: + 'If specified, only events with comments containing the keyword are returned', + }, + addedLabels: { + type: 'array', + items: { + type: 'string', + }, + description: + 'If specified, only events where all of these labels were added are returned', + }, + removedLabels: { + type: 'array', + items: { + type: 'string', + }, + description: + 'If specified, only events where all of these labels were removed are returned', + }, + reportTypes: { + type: 'array', + items: { + type: 'string', + }, + }, cursor: { type: 'string', }, diff --git a/packages/api/src/client/types/com/atproto/admin/defs.ts b/packages/api/src/client/types/com/atproto/admin/defs.ts index da154f8a845..c0d8157e6ac 100644 --- a/packages/api/src/client/types/com/atproto/admin/defs.ts +++ b/packages/api/src/client/types/com/atproto/admin/defs.ts @@ -40,6 +40,7 @@ export interface ModEventView { | ModEventEscalate | ModEventMute | ModEventEmail + | ModEventResolveAppeal | { $type: string; [k: string]: unknown } subject: | RepoRef @@ -76,6 +77,7 @@ export interface ModEventViewDetail { | ModEventAcknowledge | ModEventEscalate | ModEventMute + | ModEventEmail | ModEventResolveAppeal | { $type: string; [k: string]: unknown } subject: diff --git a/packages/api/src/client/types/com/atproto/admin/queryModerationEvents.ts b/packages/api/src/client/types/com/atproto/admin/queryModerationEvents.ts index ed21c739bcb..1540babae51 100644 --- a/packages/api/src/client/types/com/atproto/admin/queryModerationEvents.ts +++ b/packages/api/src/client/types/com/atproto/admin/queryModerationEvents.ts @@ -14,10 +14,23 @@ export interface QueryParams { createdBy?: string /** Sort direction for the events. Defaults to descending order of created at timestamp. */ sortDirection?: 'asc' | 'desc' + /** Retrieve events created after a given timestamp */ + createdAfter?: string + /** Retrieve events created before a given timestamp */ + createdBefore?: string subject?: string /** If true, events on all record types (posts, lists, profile etc.) owned by the did are returned */ includeAllUserRecords?: boolean limit?: number + /** If true, only events with comments are returned */ + hasComment?: boolean + /** If specified, only events with comments containing the keyword are returned */ + comment?: string + /** If specified, only events where all of these labels were added are returned */ + addedLabels?: string[] + /** If specified, only events where all of these labels were removed are returned */ + removedLabels?: string[] + reportTypes?: string[] cursor?: string } diff --git a/packages/bsky/src/lexicon/lexicons.ts b/packages/bsky/src/lexicon/lexicons.ts index 08a70f8ca1d..515098a8f49 100644 --- a/packages/bsky/src/lexicon/lexicons.ts +++ b/packages/bsky/src/lexicon/lexicons.ts @@ -91,6 +91,7 @@ export const schemaDict = { 'lex:com.atproto.admin.defs#modEventEscalate', 'lex:com.atproto.admin.defs#modEventMute', 'lex:com.atproto.admin.defs#modEventEmail', + 'lex:com.atproto.admin.defs#modEventResolveAppeal', ], }, subject: { @@ -147,6 +148,7 @@ export const schemaDict = { 'lex:com.atproto.admin.defs#modEventAcknowledge', 'lex:com.atproto.admin.defs#modEventEscalate', 'lex:com.atproto.admin.defs#modEventMute', + 'lex:com.atproto.admin.defs#modEventEmail', 'lex:com.atproto.admin.defs#modEventResolveAppeal', ], }, @@ -1450,6 +1452,16 @@ export const schemaDict = { description: 'Sort direction for the events. Defaults to descending order of created at timestamp.', }, + createdAfter: { + type: 'string', + format: 'datetime', + description: 'Retrieve events created after a given timestamp', + }, + createdBefore: { + type: 'string', + format: 'datetime', + description: 'Retrieve events created before a given timestamp', + }, subject: { type: 'string', format: 'uri', @@ -1466,6 +1478,37 @@ export const schemaDict = { maximum: 100, default: 50, }, + hasComment: { + type: 'boolean', + description: 'If true, only events with comments are returned', + }, + comment: { + type: 'string', + description: + 'If specified, only events with comments containing the keyword are returned', + }, + addedLabels: { + type: 'array', + items: { + type: 'string', + }, + description: + 'If specified, only events where all of these labels were added are returned', + }, + removedLabels: { + type: 'array', + items: { + type: 'string', + }, + description: + 'If specified, only events where all of these labels were removed are returned', + }, + reportTypes: { + type: 'array', + items: { + type: 'string', + }, + }, cursor: { type: 'string', }, diff --git a/packages/bsky/src/lexicon/types/com/atproto/admin/defs.ts b/packages/bsky/src/lexicon/types/com/atproto/admin/defs.ts index 41be2ad96e7..2fab0bc19a4 100644 --- a/packages/bsky/src/lexicon/types/com/atproto/admin/defs.ts +++ b/packages/bsky/src/lexicon/types/com/atproto/admin/defs.ts @@ -40,6 +40,7 @@ export interface ModEventView { | ModEventEscalate | ModEventMute | ModEventEmail + | ModEventResolveAppeal | { $type: string; [k: string]: unknown } subject: | RepoRef @@ -76,6 +77,7 @@ export interface ModEventViewDetail { | ModEventAcknowledge | ModEventEscalate | ModEventMute + | ModEventEmail | ModEventResolveAppeal | { $type: string; [k: string]: unknown } subject: diff --git a/packages/bsky/src/lexicon/types/com/atproto/admin/queryModerationEvents.ts b/packages/bsky/src/lexicon/types/com/atproto/admin/queryModerationEvents.ts index f3c4f1fbb95..9972b688b71 100644 --- a/packages/bsky/src/lexicon/types/com/atproto/admin/queryModerationEvents.ts +++ b/packages/bsky/src/lexicon/types/com/atproto/admin/queryModerationEvents.ts @@ -15,10 +15,23 @@ export interface QueryParams { createdBy?: string /** Sort direction for the events. Defaults to descending order of created at timestamp. */ sortDirection: 'asc' | 'desc' + /** Retrieve events created after a given timestamp */ + createdAfter?: string + /** Retrieve events created before a given timestamp */ + createdBefore?: string subject?: string /** If true, events on all record types (posts, lists, profile etc.) owned by the did are returned */ includeAllUserRecords: boolean limit: number + /** If true, only events with comments are returned */ + hasComment?: boolean + /** If specified, only events with comments containing the keyword are returned */ + comment?: string + /** If specified, only events where all of these labels were added are returned */ + addedLabels?: string[] + /** If specified, only events where all of these labels were removed are returned */ + removedLabels?: string[] + reportTypes?: string[] cursor?: string } diff --git a/packages/bsky/tests/auto-moderator/labeler.test.ts b/packages/bsky/tests/auto-moderator/labeler.test.ts index b735ebb28b2..e0414a0d627 100644 --- a/packages/bsky/tests/auto-moderator/labeler.test.ts +++ b/packages/bsky/tests/auto-moderator/labeler.test.ts @@ -103,6 +103,8 @@ describe('labeler', () => { subject: uri.toString(), limit: 10, types: [], + addedLabels: [], + removedLabels: [], }) expect(events.length).toBe(1) expect(events[0]).toMatchObject({ diff --git a/packages/ozone/src/api/admin/queryModerationEvents.ts b/packages/ozone/src/api/admin/queryModerationEvents.ts index 4c0cbdd1500..b2ea4df7323 100644 --- a/packages/ozone/src/api/admin/queryModerationEvents.ts +++ b/packages/ozone/src/api/admin/queryModerationEvents.ts @@ -13,7 +13,14 @@ export default function (server: Server, ctx: AppContext) { sortDirection = 'desc', types, includeAllUserRecords = false, + hasComment, + comment, createdBy, + createdAfter, + createdBefore, + addedLabels = [], + removedLabels = [], + reportTypes, } = params const db = ctx.db const modService = ctx.modService(db) @@ -25,6 +32,13 @@ export default function (server: Server, ctx: AppContext) { cursor, sortDirection, includeAllUserRecords, + hasComment, + comment, + createdAfter, + createdBefore, + addedLabels, + removedLabels, + reportTypes, }) return { encoding: 'application/json', diff --git a/packages/ozone/src/api/moderation/util.ts b/packages/ozone/src/api/moderation/util.ts index 040007d5e79..f78829240d0 100644 --- a/packages/ozone/src/api/moderation/util.ts +++ b/packages/ozone/src/api/moderation/util.ts @@ -62,4 +62,5 @@ const eventTypes = new Set([ 'com.atproto.admin.defs#modEventUnmute', 'com.atproto.admin.defs#modEventReverseTakedown', 'com.atproto.admin.defs#modEventEmail', + 'com.atproto.admin.defs#modEventResolveAppeal', ]) diff --git a/packages/ozone/src/lexicon/lexicons.ts b/packages/ozone/src/lexicon/lexicons.ts index 08a70f8ca1d..515098a8f49 100644 --- a/packages/ozone/src/lexicon/lexicons.ts +++ b/packages/ozone/src/lexicon/lexicons.ts @@ -91,6 +91,7 @@ export const schemaDict = { 'lex:com.atproto.admin.defs#modEventEscalate', 'lex:com.atproto.admin.defs#modEventMute', 'lex:com.atproto.admin.defs#modEventEmail', + 'lex:com.atproto.admin.defs#modEventResolveAppeal', ], }, subject: { @@ -147,6 +148,7 @@ export const schemaDict = { 'lex:com.atproto.admin.defs#modEventAcknowledge', 'lex:com.atproto.admin.defs#modEventEscalate', 'lex:com.atproto.admin.defs#modEventMute', + 'lex:com.atproto.admin.defs#modEventEmail', 'lex:com.atproto.admin.defs#modEventResolveAppeal', ], }, @@ -1450,6 +1452,16 @@ export const schemaDict = { description: 'Sort direction for the events. Defaults to descending order of created at timestamp.', }, + createdAfter: { + type: 'string', + format: 'datetime', + description: 'Retrieve events created after a given timestamp', + }, + createdBefore: { + type: 'string', + format: 'datetime', + description: 'Retrieve events created before a given timestamp', + }, subject: { type: 'string', format: 'uri', @@ -1466,6 +1478,37 @@ export const schemaDict = { maximum: 100, default: 50, }, + hasComment: { + type: 'boolean', + description: 'If true, only events with comments are returned', + }, + comment: { + type: 'string', + description: + 'If specified, only events with comments containing the keyword are returned', + }, + addedLabels: { + type: 'array', + items: { + type: 'string', + }, + description: + 'If specified, only events where all of these labels were added are returned', + }, + removedLabels: { + type: 'array', + items: { + type: 'string', + }, + description: + 'If specified, only events where all of these labels were removed are returned', + }, + reportTypes: { + type: 'array', + items: { + type: 'string', + }, + }, cursor: { type: 'string', }, diff --git a/packages/ozone/src/lexicon/types/com/atproto/admin/defs.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/defs.ts index 41be2ad96e7..2fab0bc19a4 100644 --- a/packages/ozone/src/lexicon/types/com/atproto/admin/defs.ts +++ b/packages/ozone/src/lexicon/types/com/atproto/admin/defs.ts @@ -40,6 +40,7 @@ export interface ModEventView { | ModEventEscalate | ModEventMute | ModEventEmail + | ModEventResolveAppeal | { $type: string; [k: string]: unknown } subject: | RepoRef @@ -76,6 +77,7 @@ export interface ModEventViewDetail { | ModEventAcknowledge | ModEventEscalate | ModEventMute + | ModEventEmail | ModEventResolveAppeal | { $type: string; [k: string]: unknown } subject: diff --git a/packages/ozone/src/lexicon/types/com/atproto/admin/queryModerationEvents.ts b/packages/ozone/src/lexicon/types/com/atproto/admin/queryModerationEvents.ts index f3c4f1fbb95..9972b688b71 100644 --- a/packages/ozone/src/lexicon/types/com/atproto/admin/queryModerationEvents.ts +++ b/packages/ozone/src/lexicon/types/com/atproto/admin/queryModerationEvents.ts @@ -15,10 +15,23 @@ export interface QueryParams { createdBy?: string /** Sort direction for the events. Defaults to descending order of created at timestamp. */ sortDirection: 'asc' | 'desc' + /** Retrieve events created after a given timestamp */ + createdAfter?: string + /** Retrieve events created before a given timestamp */ + createdBefore?: string subject?: string /** If true, events on all record types (posts, lists, profile etc.) owned by the did are returned */ includeAllUserRecords: boolean limit: number + /** If true, only events with comments are returned */ + hasComment?: boolean + /** If specified, only events with comments containing the keyword are returned */ + comment?: string + /** If specified, only events where all of these labels were added are returned */ + addedLabels?: string[] + /** If specified, only events where all of these labels were removed are returned */ + removedLabels?: string[] + reportTypes?: string[] cursor?: string } diff --git a/packages/ozone/src/mod-service/index.ts b/packages/ozone/src/mod-service/index.ts index 0ce130bf8d2..fee4cc1784e 100644 --- a/packages/ozone/src/mod-service/index.ts +++ b/packages/ozone/src/mod-service/index.ts @@ -96,6 +96,13 @@ export class ModerationService { includeAllUserRecords: boolean types: ModerationEvent['action'][] sortDirection?: 'asc' | 'desc' + hasComment?: boolean + comment?: string + createdAfter?: string + createdBefore?: string + addedLabels: string[] + removedLabels: string[] + reportTypes?: string[] }): Promise<{ cursor?: string; events: ModerationEventRow[] }> { const { subject, @@ -105,6 +112,13 @@ export class ModerationService { includeAllUserRecords, sortDirection = 'desc', types, + hasComment, + comment, + createdAfter, + createdBefore, + addedLabels, + removedLabels, + reportTypes, } = opts let builder = this.db.db.selectFrom('moderation_event').selectAll() if (subject) { @@ -139,6 +153,33 @@ export class ModerationService { if (createdBy) { builder = builder.where('createdBy', '=', createdBy) } + if (createdAfter) { + builder = builder.where('createdAt', '>=', createdAfter) + } + if (createdBefore) { + builder = builder.where('createdAt', '<=', createdBefore) + } + if (comment) { + builder = builder.where('comment', 'ilike', `%${comment}%`) + } + if (hasComment) { + builder = builder.where('comment', 'is not', null) + } + + // If multiple labels are passed, then only retrieve events where all those labels exist + if (addedLabels.length) { + addedLabels.forEach((label) => { + builder = builder.where('createLabelVals', 'ilike', `%${label}%`) + }) + } + if (removedLabels.length) { + removedLabels.forEach((label) => { + builder = builder.where('negateLabelVals', 'ilike', `%${label}%`) + }) + } + if (reportTypes?.length) { + builder = builder.where(sql`meta->>'reportType'`, 'in', reportTypes) + } const { ref } = this.db.db.dynamic const keyset = new TimeIdKeyset( diff --git a/packages/ozone/tests/moderation-events.test.ts b/packages/ozone/tests/moderation-events.test.ts index 73149dc06d8..36f3b10b667 100644 --- a/packages/ozone/tests/moderation-events.test.ts +++ b/packages/ozone/tests/moderation-events.test.ts @@ -2,6 +2,7 @@ import { TestNetwork, SeedClient, basicSeed } from '@atproto/dev-env' import AtpAgent, { ComAtprotoAdminDefs } from '@atproto/api' import { forSnapshot } from './_util' import { + REASONAPPEAL, REASONMISLEADING, REASONSPAM, } from '../src/lexicon/types/com/atproto/moderation/defs' @@ -201,6 +202,99 @@ describe('moderation-events', () => { expect(reversedEvents.length).toEqual(allEvents.data.events.length) expect(reversedEvents[0].id).toEqual(defaultEvents[4].id) }) + + it('returns report events matching reportType filters', async () => { + const [spamEvents, misleadingEvents] = await Promise.all([ + queryModerationEvents({ + reportTypes: [REASONSPAM], + }), + queryModerationEvents({ + reportTypes: [REASONMISLEADING, REASONAPPEAL], + }), + ]) + + expect(misleadingEvents.data.events.length).toEqual(2) + expect(spamEvents.data.events.length).toEqual(6) + }) + + it('returns events matching keyword in comment', async () => { + const [eventsWithX, eventsWithTest, eventsWithComment] = + await Promise.all([ + queryModerationEvents({ + comment: 'X', + }), + queryModerationEvents({ + comment: 'test', + }), + queryModerationEvents({ + hasComment: true, + }), + ]) + + expect(eventsWithX.data.events.length).toEqual(10) + expect(eventsWithTest.data.events.length).toEqual(0) + expect(eventsWithComment.data.events.length).toEqual(12) + }) + + it('returns events matching filter params for columns', async () => { + const [negatedLabelEvent, createdLabelEvent] = await Promise.all([ + emitModerationEvent({ + event: { + $type: 'com.atproto.admin.defs#modEventLabel', + comment: 'X', + negateLabelVals: ['L1', 'L2'], + createLabelVals: [], + }, + // Report bob's account by alice and vice versa + subject: { + $type: 'com.atproto.admin.defs#repoRef', + did: sc.dids.alice, + }, + createdBy: sc.dids.bob, + }), + emitModerationEvent({ + event: { + $type: 'com.atproto.admin.defs#modEventLabel', + comment: 'X', + createLabelVals: ['L1', 'L2'], + negateLabelVals: [], + }, + // Report bob's account by alice and vice versa + subject: { + $type: 'com.atproto.admin.defs#repoRef', + did: sc.dids.bob, + }, + createdBy: sc.dids.alice, + }), + ]) + const [withTwoLabels, withoutTwoLabels, withOneLabel, withoutOneLabel] = + await Promise.all([ + queryModerationEvents({ + addedLabels: ['L1', 'L3'], + }), + queryModerationEvents({ + removedLabels: ['L1', 'L2'], + }), + queryModerationEvents({ + addedLabels: ['L1'], + }), + queryModerationEvents({ + removedLabels: ['L2'], + }), + ]) + + // Verify that when querying for events where 2 different labels were added + // events where all of the labels from the list was added are returned + expect(withTwoLabels.data.events.length).toEqual(0) + expect(negatedLabelEvent.data.id).toEqual( + withoutTwoLabels.data.events[0].id, + ) + + expect(createdLabelEvent.data.id).toEqual(withOneLabel.data.events[0].id) + expect(negatedLabelEvent.data.id).toEqual( + withoutOneLabel.data.events[0].id, + ) + }) }) describe('get event', () => { diff --git a/packages/pds/src/lexicon/lexicons.ts b/packages/pds/src/lexicon/lexicons.ts index 08a70f8ca1d..515098a8f49 100644 --- a/packages/pds/src/lexicon/lexicons.ts +++ b/packages/pds/src/lexicon/lexicons.ts @@ -91,6 +91,7 @@ export const schemaDict = { 'lex:com.atproto.admin.defs#modEventEscalate', 'lex:com.atproto.admin.defs#modEventMute', 'lex:com.atproto.admin.defs#modEventEmail', + 'lex:com.atproto.admin.defs#modEventResolveAppeal', ], }, subject: { @@ -147,6 +148,7 @@ export const schemaDict = { 'lex:com.atproto.admin.defs#modEventAcknowledge', 'lex:com.atproto.admin.defs#modEventEscalate', 'lex:com.atproto.admin.defs#modEventMute', + 'lex:com.atproto.admin.defs#modEventEmail', 'lex:com.atproto.admin.defs#modEventResolveAppeal', ], }, @@ -1450,6 +1452,16 @@ export const schemaDict = { description: 'Sort direction for the events. Defaults to descending order of created at timestamp.', }, + createdAfter: { + type: 'string', + format: 'datetime', + description: 'Retrieve events created after a given timestamp', + }, + createdBefore: { + type: 'string', + format: 'datetime', + description: 'Retrieve events created before a given timestamp', + }, subject: { type: 'string', format: 'uri', @@ -1466,6 +1478,37 @@ export const schemaDict = { maximum: 100, default: 50, }, + hasComment: { + type: 'boolean', + description: 'If true, only events with comments are returned', + }, + comment: { + type: 'string', + description: + 'If specified, only events with comments containing the keyword are returned', + }, + addedLabels: { + type: 'array', + items: { + type: 'string', + }, + description: + 'If specified, only events where all of these labels were added are returned', + }, + removedLabels: { + type: 'array', + items: { + type: 'string', + }, + description: + 'If specified, only events where all of these labels were removed are returned', + }, + reportTypes: { + type: 'array', + items: { + type: 'string', + }, + }, cursor: { type: 'string', }, diff --git a/packages/pds/src/lexicon/types/com/atproto/admin/defs.ts b/packages/pds/src/lexicon/types/com/atproto/admin/defs.ts index 41be2ad96e7..2fab0bc19a4 100644 --- a/packages/pds/src/lexicon/types/com/atproto/admin/defs.ts +++ b/packages/pds/src/lexicon/types/com/atproto/admin/defs.ts @@ -40,6 +40,7 @@ export interface ModEventView { | ModEventEscalate | ModEventMute | ModEventEmail + | ModEventResolveAppeal | { $type: string; [k: string]: unknown } subject: | RepoRef @@ -76,6 +77,7 @@ export interface ModEventViewDetail { | ModEventAcknowledge | ModEventEscalate | ModEventMute + | ModEventEmail | ModEventResolveAppeal | { $type: string; [k: string]: unknown } subject: diff --git a/packages/pds/src/lexicon/types/com/atproto/admin/queryModerationEvents.ts b/packages/pds/src/lexicon/types/com/atproto/admin/queryModerationEvents.ts index f3c4f1fbb95..9972b688b71 100644 --- a/packages/pds/src/lexicon/types/com/atproto/admin/queryModerationEvents.ts +++ b/packages/pds/src/lexicon/types/com/atproto/admin/queryModerationEvents.ts @@ -15,10 +15,23 @@ export interface QueryParams { createdBy?: string /** Sort direction for the events. Defaults to descending order of created at timestamp. */ sortDirection: 'asc' | 'desc' + /** Retrieve events created after a given timestamp */ + createdAfter?: string + /** Retrieve events created before a given timestamp */ + createdBefore?: string subject?: string /** If true, events on all record types (posts, lists, profile etc.) owned by the did are returned */ includeAllUserRecords: boolean limit: number + /** If true, only events with comments are returned */ + hasComment?: boolean + /** If specified, only events with comments containing the keyword are returned */ + comment?: string + /** If specified, only events where all of these labels were added are returned */ + addedLabels?: string[] + /** If specified, only events where all of these labels were removed are returned */ + removedLabels?: string[] + reportTypes?: string[] cursor?: string }