import { Component, linkEvent } from "inferno"; import { T } from "inferno-i18next-dess"; import { CommentReportView, CommentView, ResolveCommentReport, } from "lemmy-js-client"; import { i18n } from "../../i18next"; import { CommentNodeI, CommentViewType } from "../../interfaces"; import { WebSocketService } from "../../services"; import { myAuth, wsClient } from "../../utils"; import { Icon } from "../common/icon"; import { PersonListing } from "../person/person-listing"; import { CommentNode } from "./comment-node"; interface CommentReportProps { report: CommentReportView; } export class CommentReport extends Component { constructor(props: any, context: any) { super(props, context); } render() { const r = this.props.report; const comment = r.comment; const tippyContent = i18n.t( r.comment_report.resolved ? "unresolve_report" : "resolve_report" ); // Set the original post data ( a troll could change it ) comment.content = r.comment_report.original_comment_text; const comment_view: CommentView = { comment, creator: r.comment_creator, post: r.post, community: r.community, creator_banned_from_community: r.creator_banned_from_community, counts: r.counts, subscribed: "NotSubscribed", saved: false, creator_blocked: false, my_vote: r.my_vote, }; const node: CommentNodeI = { comment_view, children: [], depth: 0, }; return (
{i18n.t("reporter")}:
{i18n.t("reason")}: {r.comment_report.reason}
{r.resolver && (
{r.comment_report.resolved ? ( # ) : ( # )}
)}
); } handleResolveReport(i: CommentReport) { const auth = myAuth(); if (auth) { const form: ResolveCommentReport = { report_id: i.props.report.comment_report.id, resolved: !i.props.report.comment_report.resolved, auth, }; WebSocketService.Instance.send(wsClient.resolveCommentReport(form)); } } }