mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-12-23 11:08:13 +09:00
627e3c07b9
* implement sending AP Flag object Optionally allow a user to select to forward a report about a remote user to the other instance. This is added in a backwards-compatible way. * add locale string * forward report only for moderators * add switch to moderator UI to forward report * fix report note url * return forwarded status from API apparently forgot to carry this over from my testing environment * object in Flag activity has to be an array For correct interoperability with Pleroma the "object" property of the Flag activity has to be an array. This array will in the future also hold the link to respective notes, so it makes sense to correct this on our side. * Update get-note-menu.ts Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { EntityRepository, Repository } from 'typeorm';
|
|
import { Users } from '../index';
|
|
import { AbuseUserReport } from '@/models/entities/abuse-user-report';
|
|
import { awaitAll } from '@/prelude/await-all';
|
|
|
|
@EntityRepository(AbuseUserReport)
|
|
export class AbuseUserReportRepository extends Repository<AbuseUserReport> {
|
|
public async pack(
|
|
src: AbuseUserReport['id'] | AbuseUserReport,
|
|
) {
|
|
const report = typeof src === 'object' ? src : await this.findOneOrFail(src);
|
|
|
|
return await awaitAll({
|
|
id: report.id,
|
|
createdAt: report.createdAt,
|
|
comment: report.comment,
|
|
resolved: report.resolved,
|
|
reporterId: report.reporterId,
|
|
targetUserId: report.targetUserId,
|
|
assigneeId: report.assigneeId,
|
|
reporter: Users.pack(report.reporter || report.reporterId, null, {
|
|
detail: true,
|
|
}),
|
|
targetUser: Users.pack(report.targetUser || report.targetUserId, null, {
|
|
detail: true,
|
|
}),
|
|
assignee: report.assigneeId ? Users.pack(report.assignee || report.assigneeId, null, {
|
|
detail: true,
|
|
}) : null,
|
|
forwarded: report.forwarded,
|
|
});
|
|
}
|
|
|
|
public packMany(
|
|
reports: any[],
|
|
) {
|
|
return Promise.all(reports.map(x => this.pack(x)));
|
|
}
|
|
}
|