Incorporate suggested changes

This commit is contained in:
SleeplessOne1917 2023-08-30 19:57:09 -04:00
parent 9c70d3228a
commit 3fc02703fb
5 changed files with 15 additions and 21 deletions

@ -1 +1 @@
Subproject commit 302cf9633459ba9a0998a98551b0c178f804c6d8 Subproject commit 38bb32f6898b227aaad06a48d8bf69a5b48416d6

View file

@ -185,6 +185,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
super(props, context); super(props, context);
this.handleReplyCancel = this.handleReplyCancel.bind(this); this.handleReplyCancel = this.handleReplyCancel.bind(this);
this.handleReportComment = this.handleReportComment.bind(this);
} }
get commentView(): CommentView { get commentView(): CommentView {
@ -975,10 +976,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
</form> </form>
)} )}
{this.state.showReportDialog && ( {this.state.showReportDialog && (
<ReportForm <ReportForm onSubmit={this.handleReportComment} />
id={`report-reason-${cv.comment.id}`}
onSubmit={this.handleReportComment}
/>
)} )}
{this.state.showBanDialog && ( {this.state.showBanDialog && (
<form onSubmit={linkEvent(this, this.handleModBanBothSubmit)}> <form onSubmit={linkEvent(this, this.handleModBanBothSubmit)}>
@ -1508,7 +1506,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
}); });
} }
handleReportComment = (reason: string) => { handleReportComment(reason: string) {
this.props.onCommentReport({ this.props.onCommentReport({
comment_id: this.commentId, comment_id: this.commentId,
reason, reason,
@ -1518,7 +1516,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
this.setState({ this.setState({
showReportDialog: false, showReportDialog: false,
}); });
}; }
handlePurgeBothSubmit(i: CommentNode, event: any) { handlePurgeBothSubmit(i: CommentNode, event: any) {
event.preventDefault(); event.preventDefault();

View file

@ -1,10 +1,10 @@
import { Component, linkEvent } from "inferno"; import { Component, linkEvent } from "inferno";
import { I18NextService } from "../../services/I18NextService"; import { I18NextService } from "../../services/I18NextService";
import { Spinner } from "./icon"; import { Spinner } from "./icon";
import { randomStr } from "@utils/helpers";
interface ReportFormProps { interface ReportFormProps {
onSubmit: (reason: string) => void; onSubmit: (reason: string) => void;
id: string;
} }
interface ReportFormState { interface ReportFormState {
@ -40,8 +40,8 @@ export default class ReportForm extends Component<
} }
render() { render() {
const { id } = this.props;
const { loading, reason } = this.state; const { loading, reason } = this.state;
const id = `report-form-${randomStr()}`;
return ( return (
<form <form

View file

@ -174,6 +174,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
this.handleEditPost = this.handleEditPost.bind(this); this.handleEditPost = this.handleEditPost.bind(this);
this.handleEditCancel = this.handleEditCancel.bind(this); this.handleEditCancel = this.handleEditCancel.bind(this);
this.handleReportSubmit = this.handleReportSubmit.bind(this);
} }
componentWillReceiveProps(nextProps: PostListingProps) { componentWillReceiveProps(nextProps: PostListingProps) {
@ -1285,10 +1286,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
</form> </form>
)} )}
{this.state.showReportDialog && ( {this.state.showReportDialog && (
<ReportForm <ReportForm onSubmit={this.handleReportSubmit} />
id="post-report-reason"
onSubmit={this.handleReportSubmit}
/>
)} )}
{this.state.showPurgeDialog && ( {this.state.showPurgeDialog && (
<form <form
@ -1440,7 +1438,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
i.setState({ showReportDialog: !i.state.showReportDialog }); i.setState({ showReportDialog: !i.state.showReportDialog });
} }
handleReportSubmit = (reason: string) => { handleReportSubmit(reason: string) {
this.props.onPostReport({ this.props.onPostReport({
post_id: this.postView.post.id, post_id: this.postView.post.id,
reason, reason,
@ -1450,7 +1448,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
this.setState({ this.setState({
showReportDialog: false, showReportDialog: false,
}); });
}; }
handleBlockPersonClick(i: PostListing) { handleBlockPersonClick(i: PostListing) {
i.setState({ blockLoading: true }); i.setState({ blockLoading: true });

View file

@ -53,6 +53,7 @@ export class PrivateMessage extends Component<
constructor(props: any, context: any) { constructor(props: any, context: any) {
super(props, context); super(props, context);
this.handleReplyCancel = this.handleReplyCancel.bind(this); this.handleReplyCancel = this.handleReplyCancel.bind(this);
this.handleReportSubmit = this.handleReportSubmit.bind(this);
} }
get mine(): boolean { get mine(): boolean {
@ -248,10 +249,7 @@ export class PrivateMessage extends Component<
)} )}
</div> </div>
{this.state.showReportDialog && ( {this.state.showReportDialog && (
<ReportForm <ReportForm onSubmit={this.handleReportSubmit} />
id="pm-report-reason"
onSubmit={this.handleReportSubmit}
/>
)} )}
{this.state.showReply && ( {this.state.showReply && (
<div className="row"> <div className="row">
@ -335,7 +333,7 @@ export class PrivateMessage extends Component<
i.setState({ showReportDialog: !i.state.showReportDialog }); i.setState({ showReportDialog: !i.state.showReportDialog });
} }
handleReportSubmit = (reason: string) => { handleReportSubmit(reason: string) {
this.props.onReport({ this.props.onReport({
private_message_id: this.props.private_message_view.private_message.id, private_message_id: this.props.private_message_view.private_message.id,
reason, reason,
@ -345,5 +343,5 @@ export class PrivateMessage extends Component<
this.setState({ this.setState({
showReportDialog: false, showReportDialog: false,
}); });
}; }
} }