refactor: SystemWebhook/UserWebhookの配信処理呼び出し部分の改善 (#15035)
* UserWebhook側の対処 * SystemWebhook側の対処 * fix test
This commit is contained in:
@@ -160,22 +160,22 @@ export class AbuseReportNotificationService implements OnApplicationShutdown {
|
||||
};
|
||||
});
|
||||
|
||||
const recipientWebhookIds = await this.fetchWebhookRecipients()
|
||||
.then(it => it
|
||||
.filter(it => it.isActive && it.systemWebhookId && it.method === 'webhook')
|
||||
.map(it => it.systemWebhookId)
|
||||
.filter(x => x != null));
|
||||
for (const webhookId of recipientWebhookIds) {
|
||||
await Promise.all(
|
||||
convertedReports.map(it => {
|
||||
return this.systemWebhookService.enqueueSystemWebhook(
|
||||
webhookId,
|
||||
type,
|
||||
it,
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
const inactiveRecipients = await this.fetchWebhookRecipients()
|
||||
.then(it => it.filter(it => !it.isActive));
|
||||
const withoutWebhookIds = inactiveRecipients
|
||||
.map(it => it.systemWebhookId)
|
||||
.filter(x => x != null);
|
||||
return Promise.all(
|
||||
convertedReports.map(it => {
|
||||
return this.systemWebhookService.enqueueSystemWebhook(
|
||||
type,
|
||||
it,
|
||||
{
|
||||
excludes: withoutWebhookIds,
|
||||
},
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user