feat: implement comment reporting system

Added comprehensive comment reporting infrastructure similar to profile reporting.

API Changes:
- New CommentReport model in Prisma schema with relations to User and Comment
- CommentReportService with CRUD operations, duplicate prevention, and rate limiting
- API routes at /comment-reports for creating and managing comment reports
- Updated CommentService to include hasPendingReports flag for all comments

Frontend Changes:
- Created shared CommentDisplayComponent for reusable comment display with report button
- Updated ReportModalComponent to handle both profile and comment reports
- CommentReportService for API communication
- Integrated CommentDisplayComponent into games-list component
- Comments with pending reports show "[comment pending admin review]" message

Features:
- Users can report comments they didn't write
- Duplicate prevention (one pending report per comment per user)
- Rate limiting (5 pending reports maximum per user)
- Admins can review and action comment reports
- Comments are hidden during review to prevent abuse

Remaining Work:
- Need to integrate CommentDisplayComponent into remaining media components (books, music, art, shows, manga)
- Need to extend admin-reports page to display comment reports alongside profile reports
This commit is contained in:
2026-02-19 19:06:49 -08:00
committed by Naomi Carrigan
parent 8f569e0bb4
commit c514849f12
11 changed files with 1068 additions and 114 deletions
+14 -13
View File
@@ -15,19 +15,20 @@ interface CommentUser {
}
interface Comment {
id: string;
content: string;
rawContent?: string;
userId: string;
user: CommentUser;
gameId?: string;
bookId?: string;
musicId?: string;
artId?: string;
showId?: string;
mangaId?: string;
createdAt: Date;
updatedAt: Date;
id: string;
content: string;
rawContent?: string;
userId: string;
user: CommentUser;
gameId?: string;
bookId?: string;
musicId?: string;
artId?: string;
showId?: string;
mangaId?: string;
hasPendingReports?: boolean;
createdAt: Date;
updatedAt: Date;
}
interface CreateCommentDto {
+50
View File
@@ -58,3 +58,53 @@ export interface UpdateReportDto {
status: ReportStatus;
reviewNotes?: string;
}
export interface CommentReport {
id: string;
reportedCommentId: string;
reporterId: string;
reason: ReportReason;
details: string;
status: ReportStatus;
reviewedBy?: string;
reviewNotes?: string;
createdAt: Date;
updatedAt: Date;
}
export interface CommentReportWithDetails extends CommentReport {
reportedComment: {
id: string;
content: string;
rawContent?: string;
userId: string;
user: {
id: string;
username: string;
displayName?: string;
avatar?: string;
};
};
reporter: {
id: string;
username: string;
displayName?: string;
avatar?: string;
};
reviewer?: {
id: string;
username: string;
displayName?: string;
};
}
export interface CreateCommentReportDto {
reportedCommentId: string;
reason: ReportReason;
details: string;
}
export interface UpdateCommentReportDto {
status: ReportStatus;
reviewNotes?: string;
}