fix crashing webhook sending
This commit is contained in:
parent
0280e2a277
commit
8e60f83b6f
@ -50,12 +50,7 @@ export const POST = (async ({ request, cookies }) => {
|
||||
|
||||
let reports = await Report.findAll({
|
||||
where: reportFindOptions,
|
||||
include: [
|
||||
{ model: User, as: 'reporter' },
|
||||
{ model: User, as: 'reported' },
|
||||
{ model: Admin, as: 'auditor' },
|
||||
{ model: StrikeReason, as: 'strike_reason' }
|
||||
],
|
||||
include: [{ all: true }],
|
||||
order: [['created_at', 'DESC']],
|
||||
offset: data.from || 0,
|
||||
limit: data.limit || 100
|
||||
@ -153,12 +148,10 @@ export const PATCH = (async ({ request, cookies }) => {
|
||||
|
||||
if (webhookTriggerUsers.length > 0 && data.status == 'reviewed' && env.REPORTED_WEBHOOK) {
|
||||
for (const webhookTriggerUser of webhookTriggerUsers) {
|
||||
try {
|
||||
// no `await` to avoid blocking
|
||||
webhookUserReported(env.REPORTED_WEBHOOK, webhookTriggerUser);
|
||||
} catch (e) {
|
||||
console.error(`failed to send reported webhook: ${e}`);
|
||||
}
|
||||
// no `await` to avoid blocking
|
||||
webhookUserReported(env.REPORTED_WEBHOOK, webhookTriggerUser).catch((e) =>
|
||||
console.error(`failed to send reported webhook: ${e}`)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user