Compare commits
No commits in common. "3dd56bc471be9e9668b65ffcf45f023b4619ecb7" and "0280e2a277557340ff25962ed892f0dfabdd74c4" have entirely different histories.
3dd56bc471
...
0280e2a277
@ -50,7 +50,12 @@ export const POST = (async ({ request, cookies }) => {
|
||||
|
||||
let reports = await Report.findAll({
|
||||
where: reportFindOptions,
|
||||
include: [{ all: true }],
|
||||
include: [
|
||||
{ model: User, as: 'reporter' },
|
||||
{ model: User, as: 'reported' },
|
||||
{ model: Admin, as: 'auditor' },
|
||||
{ model: StrikeReason, as: 'strike_reason' }
|
||||
],
|
||||
order: [['created_at', 'DESC']],
|
||||
offset: data.from || 0,
|
||||
limit: data.limit || 100
|
||||
@ -134,10 +139,7 @@ export const PATCH = (async ({ request, cookies }) => {
|
||||
} else if (data.strike_reason == -1 && report.strike_reason_id != null) {
|
||||
report.strike_reason_id = null;
|
||||
report.striked_at = null;
|
||||
} else if (
|
||||
data.strike_reason != -1 &&
|
||||
(data.strike_reason != report.strike_reason_id || data.status != report.status)
|
||||
) {
|
||||
} else if (data.strike_reason != -1 && data.strike_reason != report.strike_reason_id) {
|
||||
if (!report.reported_id) return new Response(null, { status: 400 });
|
||||
const strike_reason = await StrikeReason.findByPk(data.strike_reason);
|
||||
if (strike_reason == null) return new Response(null, { status: 400 });
|
||||
@ -151,10 +153,12 @@ export const PATCH = (async ({ request, cookies }) => {
|
||||
|
||||
if (webhookTriggerUsers.length > 0 && data.status == 'reviewed' && env.REPORTED_WEBHOOK) {
|
||||
for (const webhookTriggerUser of webhookTriggerUsers) {
|
||||
// no `await` to avoid blocking
|
||||
webhookUserReported(env.REPORTED_WEBHOOK, webhookTriggerUser).catch((e) =>
|
||||
console.error(`failed to send reported webhook: ${e}`)
|
||||
);
|
||||
try {
|
||||
// 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