fix report status not updating when no strike reason is set
All checks were successful
delpoy / build-and-deploy (push) Successful in 51s

This commit is contained in:
bytedream 2023-12-29 00:46:38 +01:00
parent e991da4db3
commit 3310a82c29

View File

@ -144,7 +144,7 @@ export const PATCH = (async ({ request, cookies }) => {
} else if (data.strike_reason == -1 && report.strike_reason_id != null) { } else if (data.strike_reason == -1 && report.strike_reason_id != null) {
report.strike_reason_id = null; report.strike_reason_id = null;
report.striked_at = null; report.striked_at = null;
} else if (data.strike_reason != report.strike_reason_id) { } else if (data.strike_reason != -1 && data.strike_reason != report.strike_reason_id) {
if (!report.reported_id) return new Response(null, { status: 400 }); if (!report.reported_id) return new Response(null, { status: 400 });
const strike_reason = await StrikeReason.findByPk(data.strike_reason); const strike_reason = await StrikeReason.findByPk(data.strike_reason);
if (strike_reason == null) return new Response(null, { status: 400 }); if (strike_reason == null) return new Response(null, { status: 400 });