feat: 通報のカテゴリー化 (MisskeyIO#288)
This commit is contained in:
parent
8a8196aa09
commit
1478a6c4ba
10 changed files with 171 additions and 9 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue