Skip to content

Commit

Permalink
Merge pull request online-go#2722 from GreenAsJade/confirm_change_rep…
Browse files Browse the repository at this point in the history
…ort_type

Confirm change report type
  • Loading branch information
anoek authored Jun 20, 2024
2 parents 9511d39 + 288060d commit 1289bbd
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 16 deletions.
11 changes: 6 additions & 5 deletions src/components/AccountWarning/CannedMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,13 @@ and that abandoned game annulled.`),
no_stalling_evident: (reported) =>
interpolate(
_(`
Thank you for bringing the possible instance of stalling play by {{reported}} to
Thank you for bringing the possible instance of stalling play by {{reported}} to \
our attention. We looked into the report and don't see evidence of stalling.
Note that the correct way to signal the game has finished is to pass. If you didn't pass,
Note that the correct way to signal the game has finished is to pass. If you didn't pass, \
then your opponent is entitled to keep playing.
It may be that you need to report a different type of problem, or provide more explanation -
It may be that you need to report a different type of problem, or provide more explanation - \
you are welcome to raise a new report if that is the case.
Thank you for helping keep OGS enjoyable for everyone. We appreciate it.`),
Expand All @@ -267,10 +267,11 @@ Thanks for your recent report. We've had to change the 'report type':
{{change}}.
It makes it easier and quicker to process reports if they are raised with the
It makes it easier and quicker to process reports if they are raised with the \
correct type - if you could help with that we'd appreciate it.
If this change seems wrong, we'd welcome feedback about that - please contact a moderator to let them know.
If this change seems wrong, we'd welcome feedback about that - please contact a \
moderator to let them know.
`),
{ change },
),
Expand Down
42 changes: 31 additions & 11 deletions src/views/ReportsCenter/ViewReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { report_categories, ReportType } from "Report";
import { report_manager } from "report_manager";
import { Report } from "report_util";
import { AutoTranslate } from "AutoTranslate";
import { _, pgettext } from "translate";
import { interpolate, _, pgettext } from "translate";
import { Player } from "Player";
import { Link } from "react-router-dom";
import { post } from "requests";
Expand All @@ -38,6 +38,7 @@ import { MessageTemplate, WARNING_TEMPLATES, REPORTER_RESPONSE_TEMPLATES } from
import { ModerationActionSelector } from "./ModerationActionSelector";
import { openAnnulQueueModal, AnnulQueueModal } from "AnnulQueueModal";
import { ReportTypeSelector } from "./ReportTypeSelector";
import { alert } from "swal_config";

// Used for saving updates to the report
let report_note_id = 0;
Expand Down Expand Up @@ -261,16 +262,35 @@ export function ViewReport({ report_id, reports, onChange }: ViewReportProps): J
};

const changeReportType = (new_type: ReportType) => {
setReport({ ...report, retyped: true }); // this disables the selector on this page for this report, while action happens...
post(`moderation/incident/${report.id}`, {
id: report.id,
action: "retype",
new_type: new_type,
})
.then((_res) => {
// We need to move on to the next report, because this one is getting updated in the
// back end, and we'll get it back via that route, not by directly manipulating it here.
next();
alert
.fire({
text: interpolate(
pgettext(
"Confirmation dialog",
"Just checking: change the report type from {{report_type}} to {{new_type}}?",
),
{ report_type: report.report_type, new_type },
),
confirmButtonText: _("Yes"),
cancelButtonText: _("No"),
showCancelButton: true,
focusCancel: true,
})
.then(({ value: yes }) => {
if (yes) {
setReport({ ...report, retyped: true }); // this disables the selector on this page for this report, while action happens...
post(`moderation/incident/${report.id}`, {
id: report.id,
action: "retype",
new_type: new_type,
})
.then((_res) => {
// We need to move on to the next report, because this one is getting updated in the
// back end, and we'll get it back via that route, not by directly manipulating it here.
next();
})
.catch(errorAlerter);
}
})
.catch(errorAlerter);
};
Expand Down

0 comments on commit 1289bbd

Please sign in to comment.