mirror of
https://github.com/MisskeyIO/misskey
synced 2024-11-23 14:46:40 +09:00
enhance(backend): MisskeyIO#615 のパフォーマンス改善 (MisskeyIO#638)
This commit is contained in:
parent
2b7f438862
commit
9e4ff380ad
@ -88,13 +88,9 @@ export class ReportAbuseProcessorService {
|
||||
forwarded: resolver.forward && job.data.targetUserHost !== null && job.data.reporterHost === null,
|
||||
});
|
||||
|
||||
const activeWebhooks = await this.webhookService.getActiveWebhooks();
|
||||
for (const webhook of activeWebhooks) {
|
||||
const webhookUser = await this.usersRepository.findOneByOrFail({
|
||||
id: webhook.userId,
|
||||
});
|
||||
const isAdmin = await this.roleService.isAdministrator(webhookUser);
|
||||
if (webhook.on.includes('reportAutoResolved') && isAdmin) {
|
||||
const webhooks = (await this.webhookService.getActiveWebhooks()).filter(x => x.on.includes('reportAutoResolved'));
|
||||
for (const webhook of webhooks) {
|
||||
if (await this.roleService.isAdministrator({ id: webhook.userId, isRoot: false })) {
|
||||
this.queueService.webhookDeliver(webhook, 'reportAutoResolved', {
|
||||
resolver: resolver,
|
||||
report: job.data,
|
||||
|
@ -69,13 +69,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
forwarded: ps.forward && report.targetUserHost != null,
|
||||
}).then(() => this.abuseUserReportsRepository.findOneBy({ id: ps.reportId }));
|
||||
|
||||
const activeWebhooks = await this.webhookService.getActiveWebhooks();
|
||||
for (const webhook of activeWebhooks) {
|
||||
const webhookUser = await this.usersRepository.findOneByOrFail({
|
||||
id: webhook.userId,
|
||||
});
|
||||
const isAdmin = await this.roleService.isAdministrator(webhookUser);
|
||||
if (webhook.on.includes('reportResolved') && isAdmin) {
|
||||
const webhooks = (await this.webhookService.getActiveWebhooks()).filter(x => x.on.includes('reportResolved'));
|
||||
for (const webhook of webhooks) {
|
||||
if (await this.roleService.isAdministrator({ id: webhook.userId, isRoot: false })) {
|
||||
this.queueService.webhookDeliver(webhook, 'reportResolved', {
|
||||
updatedReport,
|
||||
});
|
||||
|
@ -100,13 +100,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||
category: ps.category,
|
||||
}).then(x => this.abuseUserReportsRepository.findOneByOrFail(x.identifiers[0]));
|
||||
|
||||
const activeWebhooks = await this.webhookService.getActiveWebhooks();
|
||||
for (const webhook of activeWebhooks) {
|
||||
const webhookUser = await this.usersRepository.findOneByOrFail({
|
||||
id: webhook.userId,
|
||||
});
|
||||
const isAdmin = await this.roleService.isAdministrator(webhookUser);
|
||||
if (webhook.on.includes('reportCreated') && isAdmin) {
|
||||
const webhooks = (await this.webhookService.getActiveWebhooks()).filter(x => x.on.includes('reportCreated'));
|
||||
for (const webhook of webhooks) {
|
||||
if (await this.roleService.isAdministrator({ id: webhook.userId, isRoot: false })) {
|
||||
this.queueService.webhookDeliver(webhook, 'reportCreated', {
|
||||
report,
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user