Skip to content

Commit

Permalink
Merge pull request online-go#2851 from GreenAsJade/devel
Browse files Browse the repository at this point in the history
Escalation note fieldname update
  • Loading branch information
anoek authored Oct 17, 2024
2 parents 97d00e9 + 1f81466 commit d55e08e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/lib/report_manager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,11 @@ class ReportManager extends EventEmitter<Events> {
this.updateIncidentReport(res);
return res;
}
public vote(report_id: number, voted_action: string, mod_note: string): Promise<Report> {
public vote(report_id: number, voted_action: string, escalation_note: string): Promise<Report> {
const res = post(`moderation/incident/${report_id}`, {
action: "vote", // darn, yes, two different uses of the word "action" collide here
voted_action: voted_action,
mod_note,
escalation_note: escalation_note,
}).then((res) => {
toast(
<div>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/report_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export interface Report {
available_actions: Array<string>; // community moderator actions
vote_counts: { [action: string]: number };
voters: Vote[]; // votes from community moderators on this report
community_mod_note: string;
escalation_note: string;

unclaim: () => void;
claim: () => void;
Expand Down
10 changes: 5 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 [community_mod_note, setModNote] = React.useState("");
const [escalation_note, setEscalationNote] = React.useState("");
const [voted, setVoted] = React.useState(false);

const updateSelectedAction = (e: React.ChangeEvent<HTMLInputElement>) => {
Expand Down Expand Up @@ -219,8 +219,8 @@ export function ModerationActionSelector({
"Reason for escalating?",
)}
rows={5}
value={community_mod_note}
onChange={(ev) => setModNote(ev.target.value)}
value={escalation_note}
onChange={(ev) => setEscalationNote(ev.target.value)}
/>
)}
<span className="action-buttons">
Expand All @@ -238,11 +238,11 @@ export function ModerationActionSelector({
disabled={
voted ||
!selectedOption ||
(selectedOption === "escalate" && !community_mod_note)
(selectedOption === "escalate" && !escalation_note)
}
onClick={() => {
setVoted(true);
submit(selectedOption, community_mod_note);
submit(selectedOption, escalation_note);
}}
>
{llm_pgettext("A label on a button for submitting a vote", "Vote")}
Expand Down
2 changes: 1 addition & 1 deletion src/views/ReportsCenter/ViewReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ export function ViewReport({ report_id, reports, onChange }: ViewReportProps): J
<div className="notes">
<h4>Escalator's note:</h4>
<div className="Card">
{report.community_mod_note || "(none provided)"}
{report.escalation_note || "(none provided)"}
</div>
</div>
)}
Expand Down

0 comments on commit d55e08e

Please sign in to comment.