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);
this.handleReplyCancel = this.handleReplyCancel.bind(this);
this.handleReportComment = this.handleReportComment.bind(this);
}
get commentView(): CommentView {
@ -975,10 +976,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
</form>
)}
{this.state.showReportDialog && (
<ReportForm
id={`report-reason-${cv.comment.id}`}
onSubmit={this.handleReportComment}
/>
<ReportForm onSubmit={this.handleReportComment} />
)}
{this.state.showBanDialog && (
<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({
comment_id: this.commentId,
reason,
@ -1518,7 +1516,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
this.setState({
showReportDialog: false,
});
};
}
handlePurgeBothSubmit(i: CommentNode, event: any) {
event.preventDefault();

View file

@ -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 (
<form

View file

@ -174,6 +174,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
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<PostListingProps, PostListingState> {
</form>
)}
{this.state.showReportDialog && (
<ReportForm
id="post-report-reason"
onSubmit={this.handleReportSubmit}
/>
<ReportForm onSubmit={this.handleReportSubmit} />
)}
{this.state.showPurgeDialog && (
<form
@ -1440,7 +1438,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
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<PostListingProps, PostListingState> {
this.setState({
showReportDialog: false,
});
};
}
handleBlockPersonClick(i: PostListing) {
i.setState({ blockLoading: true });

View file

@ -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<
)}
</div>
{this.state.showReportDialog && (
<ReportForm
id="pm-report-reason"
onSubmit={this.handleReportSubmit}
/>
<ReportForm onSubmit={this.handleReportSubmit} />
)}
{this.state.showReply && (
<div className="row">
@ -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,
});
};
}
}