import { Component, InfernoNode, linkEvent } from "inferno"; import { T } from "inferno-i18next-dess"; import { PrivateMessageReportView, ResolvePrivateMessageReport, } from "lemmy-js-client"; import { i18n } from "../../i18next"; import { mdToHtml, myAuthRequired } from "../../utils"; import { Icon, Spinner } from "../common/icon"; import { PersonListing } from "../person/person-listing"; interface Props { report: PrivateMessageReportView; onResolveReport(form: ResolvePrivateMessageReport): void; } interface State { loading: boolean; } export class PrivateMessageReport extends Component { state: State = { loading: false, }; constructor(props: any, context: any) { super(props, context); } componentWillReceiveProps( nextProps: Readonly<{ children?: InfernoNode } & Props> ): void { if (this.props != nextProps) { this.setState({ loading: false }); } } render() { const r = this.props.report; const pmr = r.private_message_report; const tippyContent = i18n.t( r.private_message_report.resolved ? "unresolve_report" : "resolve_report" ); return (
{i18n.t("creator")}:{" "}
{i18n.t("message")}:
{i18n.t("reporter")}:
{i18n.t("reason")}: {pmr.reason}
{r.resolver && (
{pmr.resolved ? ( # ) : ( # )}
)}
); } handleResolveReport(i: PrivateMessageReport) { i.setState({ loading: true }); const pmr = i.props.report.private_message_report; i.props.onResolveReport({ report_id: pmr.id, resolved: !pmr.resolved, auth: myAuthRequired(), }); } }