feat: 通報のカテゴリー化 (MisskeyIO#288)
This commit is contained in:
@@ -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);
|
||||
|
@@ -48,6 +48,7 @@ export const paramDef = {
|
||||
properties: {
|
||||
userId: { type: 'string', format: 'misskey:id' },
|
||||
comment: { type: 'string', minLength: 1, maxLength: 2048 },
|
||||
category: { type: 'string', minLength: 1, maxLength: 20, default: 'other' },
|
||||
},
|
||||
required: ['userId', 'comment'],
|
||||
} as const;
|
||||
@@ -85,6 +86,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
reporterId: me.id,
|
||||
reporterHost: null,
|
||||
comment: ps.comment,
|
||||
category: ps.category,
|
||||
}).then(x => this.abuseUserReportsRepository.findOneByOrFail(x.identifiers[0]));
|
||||
|
||||
this.queueService.createReportAbuseJob(report);
|
||||
|
Reference in New Issue
Block a user