Skip to content

Commit

Permalink
Merge pull request #2850 from GreenAsJade/enforce_escalation_note
Browse files Browse the repository at this point in the history
Require CMs to give an escalation reason,
  • Loading branch information
anoek authored Oct 16, 2024
2 parents b85b1da + 8974627 commit 671315e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
17 changes: 12 additions & 5 deletions src/views/ReportsCenter/ModerationActionSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export function ModerationActionSelector({
const reportedBySelf = user.id === report.reporting_user.id;

const [selectedOption, setSelectedOption] = React.useState("");
const [mod_note, setModNote] = React.useState("");
const [community_mod_note, setModNote] = React.useState("");
const [voted, setVoted] = React.useState(false);

const updateSelectedAction = (e: React.ChangeEvent<HTMLInputElement>) => {
Expand Down Expand Up @@ -214,9 +214,12 @@ export function ModerationActionSelector({
{selectedOption === "escalate" && (
<textarea
id="mod-note-text"
placeholder={_("Message for moderators...")}
placeholder={llm_pgettext(
"A placeholder prompting community moderators for the reason why they are escalating a report",
"Reason for escalating?",
)}
rows={5}
value={mod_note}
value={community_mod_note}
onChange={(ev) => setModNote(ev.target.value)}
/>
)}
Expand All @@ -232,10 +235,14 @@ export function ModerationActionSelector({
{((action_choices && enable) || null) && (
<button
className="success"
disabled={voted || !selectedOption}
disabled={
voted ||
!selectedOption ||
(selectedOption === "escalate" && !community_mod_note)
}
onClick={() => {
setVoted(true);
submit(selectedOption, mod_note);
submit(selectedOption, community_mod_note);
}}
>
{llm_pgettext("A label on a button for submitting a vote", "Vote")}
Expand Down
5 changes: 3 additions & 2 deletions src/views/ReportsCenter/ViewReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -541,11 +541,12 @@ export function ViewReport({ report_id, reports, onChange }: ViewReportProps): J
)}

{report.escalated &&
report.community_mod_note &&
(user.is_moderator || user.moderator_powers & MODERATOR_POWERS.SUSPEND) && (
<div className="notes">
<h4>Escalator's note:</h4>
<div className="Card">{report.community_mod_note}</div>
<div className="Card">
{report.community_mod_note || "(none provided)"}
</div>
</div>
)}

Expand Down

0 comments on commit 671315e

Please sign in to comment.