feat: 通報のカテゴリー化 (MisskeyIO#288)

This commit is contained in:
CyberRex
2023-12-28 12:16:34 +09:00
committed by GitHub
parent 8a8196aa09
commit 1478a6c4ba
10 changed files with 171 additions and 9 deletions

View File

@@ -74,6 +74,10 @@ export const meta = {
nullable: true, optional: true,
ref: 'User',
},
category: {
type: 'string',
nullable: false, optional: false,
}
},
},
},
@@ -89,6 +93,7 @@ export const paramDef = {
reporterOrigin: { type: 'string', enum: ['combined', 'local', 'remote'], default: 'combined' },
targetUserOrigin: { type: 'string', enum: ['combined', 'local', 'remote'], default: 'combined' },
forwarded: { type: 'boolean', default: false },
category: { type: 'string', nullable: true, default: null },
},
required: [],
} as const;
@@ -120,6 +125,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
case 'remote': query.andWhere('report.targetUserHost IS NOT NULL'); break;
}
if (ps.category) {
query.andWhere('report.category = :category', { category: ps.category });
}
const reports = await query.limit(ps.limit).getMany();
return await this.abuseUserReportEntityService.packMany(reports, me);