Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib/services/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down