enhance(backend): MisskeyIO#615 のパフォーマンス改善 (MisskeyIO#638)

This commit is contained in:
まっちゃとーにゅ 2024-05-24 21:40:09 +09:00 committed by GitHub
parent 2b7f438862
commit 9e4ff380ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 21 deletions

View file

@ -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,