feat(moderation): resource-centric reported comments/events pages
Rework 内容审核 pages around reported resources instead of individual reports, matching the new backend endpoints: rows group all reports on one comment/event, with a slide-over listing report details and per-row actions 通过并屏蔽 (approve) / 驳回举报 (reject) / 撤销屏蔽 (revert). Filters: 待处理 / 已屏蔽 / 全部. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import { api } from '@/api/client'
|
||||
import type { ApiResponse, CommentReport, ListParams, PaginatedResponse } from '@/api/types'
|
||||
import type { ApiResponse, ListParams, PaginatedResponse, ReportedComment } from '@/api/types'
|
||||
|
||||
const BASE = '/api/admin/v1/comments'
|
||||
|
||||
export type CommentReportAction = 'hide' | 'delete' | 'dismiss'
|
||||
export type ModerationAction = 'approve' | 'reject' | 'revert'
|
||||
|
||||
export function fetchCommentReports(params: ListParams) {
|
||||
return api.get<PaginatedResponse<CommentReport>>(`${BASE}/reports`, params)
|
||||
export function fetchReportedComments(params: ListParams) {
|
||||
return api.get<PaginatedResponse<ReportedComment>>(`${BASE}/reported`, params)
|
||||
}
|
||||
|
||||
export function handleCommentReport(id: number, action: CommentReportAction) {
|
||||
return api.patch<ApiResponse<CommentReport>>(`${BASE}/reports/${id}`, { action })
|
||||
export function moderateReportedComment(id: number, action: ModerationAction) {
|
||||
return api.patch<ApiResponse<ReportedComment>>(`${BASE}/reported/${id}`, { action })
|
||||
}
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import { api } from '@/api/client'
|
||||
import type { ApiResponse, FileXEventReport, ListParams, PaginatedResponse } from '@/api/types'
|
||||
import type { ApiResponse, ListParams, PaginatedResponse, ReportedEvent } from '@/api/types'
|
||||
import type { ModerationAction } from '@/api/modules/comments'
|
||||
|
||||
const BASE = '/api/admin/v1/file-x'
|
||||
|
||||
export type EventReportAction = 'hide' | 'delete' | 'resolve' | 'dismiss'
|
||||
|
||||
export function fetchEventReports(params: ListParams) {
|
||||
return api.get<PaginatedResponse<FileXEventReport>>(`${BASE}/event-reports`, params)
|
||||
export function fetchReportedEvents(params: ListParams) {
|
||||
return api.get<PaginatedResponse<ReportedEvent>>(`${BASE}/reported-events`, params)
|
||||
}
|
||||
|
||||
export function handleEventReport(id: number, action: EventReportAction) {
|
||||
return api.patch<ApiResponse<FileXEventReport>>(`${BASE}/event-reports/${id}`, { action })
|
||||
export function moderateReportedEvent(id: number, action: ModerationAction) {
|
||||
return api.patch<ApiResponse<ReportedEvent>>(`${BASE}/reported-events/${id}`, { action })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user