From 0e0bed1e7e8fe10d17c3b02d01616a1786940e7d Mon Sep 17 00:00:00 2001 From: Alzer Del Zeyger <75466035+Dx-Alz-xD@users.noreply.github.com> Date: Wed, 11 Nov 2026 19:32:00 +0530 Subject: [PATCH] fix(report-tag): only count open reports toward the limit the five report cap counted resolved reports too, so once a paper had five reports nobody could report it again even after they were fixed --- src/lib/services/report.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/services/report.ts b/src/lib/services/report.ts index 67e70be..2a8c200 100644 --- a/src/lib/services/report.ts +++ b/src/lib/services/report.ts @@ -21,9 +21,9 @@ interface ReportedFieldInput { export async function reportTag(paperId: string, body: ReportTagBody) { await connectToDatabase(); - const count = await TagReport.countDocuments({ paperId }); + const openReports = await TagReport.countDocuments({ paperId, resolved: { $ne: true } }); - if (count >= MAX_REPORTS_PER_PAPER) { + if (openReports >= MAX_REPORTS_PER_PAPER) { throw new CustomError("Received many reports; we are currently working on it.", 429) } const reportedFields: ReportedFieldInput[] = Array.isArray(body.reportedFields)