From 3dd56bc471be9e9668b65ffcf45f023b4619ecb7 Mon Sep 17 00:00:00 2001 From: bytedream Date: Fri, 20 Dec 2024 20:56:38 +0100 Subject: [PATCH] fix strike date not set if status changed but strike reason not --- src/routes/admin/reports/+server.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/routes/admin/reports/+server.ts b/src/routes/admin/reports/+server.ts index 735393d..c042e20 100644 --- a/src/routes/admin/reports/+server.ts +++ b/src/routes/admin/reports/+server.ts @@ -134,7 +134,10 @@ 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) { + } else if ( + data.strike_reason != -1 && + (data.strike_reason != report.strike_reason_id || data.status != report.status) + ) { 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 });