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