diff --git a/src/components/IncidentReportTracker/IncidentReportTracker.tsx b/src/components/IncidentReportTracker/IncidentReportTracker.tsx index f4af171c8f..a4e5adfef5 100644 --- a/src/components/IncidentReportTracker/IncidentReportTracker.tsx +++ b/src/components/IncidentReportTracker/IncidentReportTracker.tsx @@ -181,7 +181,7 @@ export function IncidentReportTracker(): JSX.Element { navigate(`/reports-center/all/${report_id}`); }; - const reports = report_manager.sorted_active_incident_reports; + const reports = report_manager.getAvailableReports(); const hide_indicator = (reports.length === 0 && !user.is_moderator) || prefer_hidden; function getReportType(report: Report): string { diff --git a/src/lib/report_manager.tsx b/src/lib/report_manager.tsx index fb62141e82..10b62dcdd5 100644 --- a/src/lib/report_manager.tsx +++ b/src/lib/report_manager.tsx @@ -37,6 +37,8 @@ import { MOD_POWER_HANDLE_SCORE_CHEAT, MOD_POWER_HANDLE_ESCAPING } from "./misc" export const DAILY_REPORT_GOAL = 10; +const DONT_OFFER_COMMUNITY_MODERATION_TYPES_TO_MODERATORS = false; + interface Vote { voter_id: number; action: string; @@ -229,13 +231,27 @@ class ReportManager extends EventEmitter { // don't hand community moderation reports to full mods unless the report is escalated, // because community moderators are supposed to do these! if ( + DONT_OFFER_COMMUNITY_MODERATION_TYPES_TO_MODERATORS && user.is_moderator && + !(report.moderator?.id === user.id) && // maybe they already have it, so they need to see it (report.report_type === "score_cheating" || report.report_type === "escaping") && !report.escalated ) { return false; } - return !report.moderator || report.moderator?.id === user.id; + + // Never give a claimed report to community moderators + if (!user.is_moderator && report.moderator?.id) { + console.log("Not giving to community moderator", report.id); + return false; + } + + if (report.moderator && report.moderator.id !== user.id) { + // claimed reports are not given out to others + return false; + } + + return true; }); } diff --git a/src/views/ReportsCenter/ModerationActionSelector.tsx b/src/views/ReportsCenter/ModerationActionSelector.tsx index 57b43874fd..109f7dde73 100644 --- a/src/views/ReportsCenter/ModerationActionSelector.tsx +++ b/src/views/ReportsCenter/ModerationActionSelector.tsx @@ -16,13 +16,12 @@ */ import * as React from "react"; -import { Report } from "report_manager"; -import { pgettext } from "translate"; +import { _, pgettext } from "translate"; import * as DynamicHelp from "react-dynamic-help"; interface ModerationActionSelectorProps { - report: Report; + available_actions: string[]; enable: boolean; claim: () => void; submit: (action: string) => void; @@ -60,7 +59,7 @@ const ACTION_PROMPTS = { }; export function ModerationActionSelector({ - report, + available_actions, enable, claim, submit, @@ -76,37 +75,46 @@ export function ModerationActionSelector({ const { ref: voting_pane } = registerTargetItem("voting-pane"); const { ref: escalate_option } = registerTargetItem("escalate-option"); + const action_choices = available_actions ? available_actions : ["escalate"]; + return ( -
+

{pgettext( "The heading for community moderators 'action choices' section", "Actions", )}

- {report.available_actions.map((a) => ( -
- - + {(!available_actions || null) && ( +
+ {_("This report has no available actions yet. You can escalate or ignore it.")} +
+ )} + {!enable && ( +
+ {_("This report was handled after you decided to look at it!")}
- ))} - {(report.available_actions || null) && ( - )} diff --git a/src/views/ReportsCenter/ReportsCenter.styl b/src/views/ReportsCenter/ReportsCenter.styl index 38bbcc4b22..4d58eb8521 100644 --- a/src/views/ReportsCenter/ReportsCenter.styl +++ b/src/views/ReportsCenter/ReportsCenter.styl @@ -40,6 +40,15 @@ reports_center_content_width=56rem } } + + .voting-pane { + padding-bottom: 0.5rem; // intended to create margin for rdh highlighter + + .no-report-actions-note, .disabled-actions-note { + padding: 0 1rem 1rem 1rem; + } + } + .actions { display: grid; grid-template-columns: 1fr 1fr; diff --git a/src/views/ReportsCenter/ViewReport.tsx b/src/views/ReportsCenter/ViewReport.tsx index 7bd3f10bf2..981fdf5ed8 100644 --- a/src/views/ReportsCenter/ViewReport.tsx +++ b/src/views/ReportsCenter/ViewReport.tsx @@ -59,11 +59,15 @@ export function ViewReport({ report_id, reports, onChange }: ViewReportProps): J const [reportState, setReportState] = React.useState(report?.state); const [isAnnulQueueModalOpen, setIsAnnulQueueModalOpen] = React.useState(false); const [annulQueue, setAnnulQueue] = React.useState(report?.detected_ai_games); + const [availableActions, setAvailableActions] = React.useState(null); const related = report_manager.getRelatedReports(report_id); React.useEffect(() => { if (report_id) { + // For some reason we have to capture the state of the report at the time that report_id goes valid + // It's not clear why, but there are subsequent renders where the report state goes away, so ... + // capture what you want to use here! ... report_manager .getReport(report_id) .then((report) => { @@ -72,6 +76,7 @@ export function ViewReport({ report_id, reports, onChange }: ViewReportProps): J setModeratorId(report?.moderator?.id); setReportState(report?.state); setAnnulQueue(report?.detected_ai_games); + setAvailableActions(report?.available_actions); }) .catch((err) => { console.error(err); @@ -448,9 +453,9 @@ export function ViewReport({ report_id, reports, onChange }: ViewReportProps): J {((!user.is_moderator && user.moderator_powers) || null) && (
{ - /* dont claim*/ + /* community moderators don't claim reports */ }} submit={(action) => { void report_manager.vote(report.id, action);