From 3fc02703fb749efc7bca364b1a99190a7577bb55 Mon Sep 17 00:00:00 2001 From: SleeplessOne1917 Date: Wed, 30 Aug 2023 19:57:09 -0400 Subject: [PATCH] Incorporate suggested changes --- lemmy-translations | 2 +- src/shared/components/comment/comment-node.tsx | 10 ++++------ src/shared/components/common/report-form.tsx | 4 ++-- src/shared/components/post/post-listing.tsx | 10 ++++------ .../components/private_message/private-message.tsx | 10 ++++------ 5 files changed, 15 insertions(+), 21 deletions(-) diff --git a/lemmy-translations b/lemmy-translations index 302cf963..38bb32f6 160000 --- a/lemmy-translations +++ b/lemmy-translations @@ -1 +1 @@ -Subproject commit 302cf9633459ba9a0998a98551b0c178f804c6d8 +Subproject commit 38bb32f6898b227aaad06a48d8bf69a5b48416d6 diff --git a/src/shared/components/comment/comment-node.tsx b/src/shared/components/comment/comment-node.tsx index f4d141b6..8f723ae9 100644 --- a/src/shared/components/comment/comment-node.tsx +++ b/src/shared/components/comment/comment-node.tsx @@ -185,6 +185,7 @@ export class CommentNode extends Component { super(props, context); this.handleReplyCancel = this.handleReplyCancel.bind(this); + this.handleReportComment = this.handleReportComment.bind(this); } get commentView(): CommentView { @@ -975,10 +976,7 @@ export class CommentNode extends Component { )} {this.state.showReportDialog && ( - + )} {this.state.showBanDialog && (
@@ -1508,7 +1506,7 @@ export class CommentNode extends Component { }); } - handleReportComment = (reason: string) => { + handleReportComment(reason: string) { this.props.onCommentReport({ comment_id: this.commentId, reason, @@ -1518,7 +1516,7 @@ export class CommentNode extends Component { this.setState({ showReportDialog: false, }); - }; + } handlePurgeBothSubmit(i: CommentNode, event: any) { event.preventDefault(); diff --git a/src/shared/components/common/report-form.tsx b/src/shared/components/common/report-form.tsx index c26e7736..b58da594 100644 --- a/src/shared/components/common/report-form.tsx +++ b/src/shared/components/common/report-form.tsx @@ -1,10 +1,10 @@ import { Component, linkEvent } from "inferno"; import { I18NextService } from "../../services/I18NextService"; import { Spinner } from "./icon"; +import { randomStr } from "@utils/helpers"; interface ReportFormProps { onSubmit: (reason: string) => void; - id: string; } interface ReportFormState { @@ -40,8 +40,8 @@ export default class ReportForm extends Component< } render() { - const { id } = this.props; const { loading, reason } = this.state; + const id = `report-form-${randomStr()}`; return ( { this.handleEditPost = this.handleEditPost.bind(this); this.handleEditCancel = this.handleEditCancel.bind(this); + this.handleReportSubmit = this.handleReportSubmit.bind(this); } componentWillReceiveProps(nextProps: PostListingProps) { @@ -1285,10 +1286,7 @@ export class PostListing extends Component { )} {this.state.showReportDialog && ( - + )} {this.state.showPurgeDialog && (
{ i.setState({ showReportDialog: !i.state.showReportDialog }); } - handleReportSubmit = (reason: string) => { + handleReportSubmit(reason: string) { this.props.onPostReport({ post_id: this.postView.post.id, reason, @@ -1450,7 +1448,7 @@ export class PostListing extends Component { this.setState({ showReportDialog: false, }); - }; + } handleBlockPersonClick(i: PostListing) { i.setState({ blockLoading: true }); diff --git a/src/shared/components/private_message/private-message.tsx b/src/shared/components/private_message/private-message.tsx index d0b9556f..cc09418c 100644 --- a/src/shared/components/private_message/private-message.tsx +++ b/src/shared/components/private_message/private-message.tsx @@ -53,6 +53,7 @@ export class PrivateMessage extends Component< constructor(props: any, context: any) { super(props, context); this.handleReplyCancel = this.handleReplyCancel.bind(this); + this.handleReportSubmit = this.handleReportSubmit.bind(this); } get mine(): boolean { @@ -248,10 +249,7 @@ export class PrivateMessage extends Component< )} {this.state.showReportDialog && ( - + )} {this.state.showReply && (
@@ -335,7 +333,7 @@ export class PrivateMessage extends Component< i.setState({ showReportDialog: !i.state.showReportDialog }); } - handleReportSubmit = (reason: string) => { + handleReportSubmit(reason: string) { this.props.onReport({ private_message_id: this.props.private_message_view.private_message.id, reason, @@ -345,5 +343,5 @@ export class PrivateMessage extends Component< this.setState({ showReportDialog: false, }); - }; + } }