1 import { Component, linkEvent } from "inferno";
2 import { T } from "inferno-i18next-dess";
4 PrivateMessageReportView,
5 ResolvePrivateMessageReport,
6 } from "lemmy-js-client";
7 import { i18n } from "../../i18next";
8 import { WebSocketService } from "../../services";
9 import { mdToHtml, myAuth, wsClient } from "../../utils";
10 import { Icon } from "../common/icon";
11 import { PersonListing } from "../person/person-listing";
14 report: PrivateMessageReportView;
17 export class PrivateMessageReport extends Component<Props, any> {
18 constructor(props: any, context: any) {
19 super(props, context);
23 let r = this.props.report;
24 let pmr = r.private_message_report;
25 let tippyContent = i18n.t(
26 r.private_message_report.resolved ? "unresolve_report" : "resolve_report"
32 {i18n.t("creator")}:{" "}
33 <PersonListing person={r.private_message_creator} />
39 dangerouslySetInnerHTML={mdToHtml(pmr.original_pm_text)}
43 {i18n.t("reporter")}: <PersonListing person={r.creator} />
46 {i18n.t("reason")}: {pmr.reason}
51 <T i18nKey="resolved_by">
53 <PersonListing person={r.resolver} />
56 <T i18nKey="unresolved_by">
58 <PersonListing person={r.resolver} />
64 className="btn btn-link btn-animate text-muted py-0"
65 onClick={linkEvent(this, this.handleResolveReport)}
66 data-tippy-content={tippyContent}
67 aria-label={tippyContent}
71 classes={`icon-inline ${
72 pmr.resolved ? "text-success" : "text-danger"
80 handleResolveReport(i: PrivateMessageReport) {
81 let pmr = i.props.report.private_message_report;
84 let form: ResolvePrivateMessageReport = {
86 resolved: !pmr.resolved,
89 WebSocketService.Instance.send(
90 wsClient.resolvePrivateMessageReport(form)