not allowing users to report themselves

closes #4269
This commit is contained in:
Miodec 2023-05-15 13:36:50 +02:00
parent 6c9eb9ec3a
commit f0ec3d36ff

View file

@ -8,6 +8,10 @@ export async function createReport(
maxReports: number,
contentReportLimit: number
): Promise<void> {
if (report.type === "user" && report.contentId === report.uid) {
throw new MonkeyError(400, "You cannot report yourself.");
}
const reportsCount = await db
.collection<MonkeyTypes.Report>(COLLECTION_NAME)
.estimatedDocumentCount();