Upgrade inferno v8.0.0 try2 (#790)

* Upgrade non-breaking deps.

* Upgrade to Inferno v8. Fixes #731

* Upgrading inferno-i18next-dess
This commit is contained in:
Dessalines 2022-09-22 11:03:35 -04:00 committed by GitHub
parent cc90ded31e
commit 6320357d21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 2960 additions and 2641 deletions

View file

@ -147,13 +147,14 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
// TODO see if there's a better way to do this, and all willReceiveProps
componentWillReceiveProps(nextProps: CommentNodeProps) {
let cv = nextProps.node.comment_view;
this.state.my_vote = cv.my_vote;
this.state.upvotes = cv.counts.upvotes;
this.state.downvotes = cv.counts.downvotes;
this.state.score = cv.counts.score;
this.state.readLoading = false;
this.state.saveLoading = false;
this.setState(this.state);
this.setState({
my_vote: cv.my_vote,
upvotes: cv.counts.upvotes,
downvotes: cv.counts.downvotes,
score: cv.counts.score,
readLoading: false,
saveLoading: false,
});
}
render() {
@ -227,10 +228,12 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
}
>
<div
class={`${!this.props.noIndent && this.props.node.depth && "ml-2"}`}
className={`${
!this.props.noIndent && this.props.node.depth && "ml-2"
}`}
>
<div class="d-flex flex-wrap align-items-center text-muted small">
<span class="mr-2">
<div className="d-flex flex-wrap align-items-center text-muted small">
<span className="mr-2">
<PersonListing person={cv.creator} />
</span>
{cv.comment.distinguished && (
@ -263,16 +266,16 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
)}
{this.props.showCommunity && (
<>
<span class="mx-1">{i18n.t("to")}</span>
<span className="mx-1">{i18n.t("to")}</span>
<CommunityLink community={cv.community} />
<span class="mx-2"></span>
<span className="mx-2"></span>
<Link className="mr-2" to={`/post/${cv.post.id}`}>
{cv.post.name}
</Link>
</>
)}
<button
class="btn btn-sm text-muted"
className="btn btn-sm text-muted"
onClick={linkEvent(this, this.handleCommentCollapse)}
aria-label={this.expandText}
data-tippy-content={this.expandText}
@ -294,7 +297,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
data-tippy-content={this.pointsTippy}
>
<span
class="mr-1 font-weight-bold"
className="mr-1 font-weight-bold"
aria-label={i18n.t("number_of_points", {
count: this.state.score,
formattedCount: this.state.score,
@ -335,11 +338,11 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
)}
/>
)}
<div class="d-flex justify-content-between justify-content-lg-start flex-wrap text-muted font-weight-bold">
<div className="d-flex justify-content-between justify-content-lg-start flex-wrap text-muted font-weight-bold">
{this.props.showContext && this.linkBtn()}
{this.props.markable && (
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(this, this.handleMarkRead)}
data-tippy-content={
this.commentReplyOrMentionRead
@ -380,7 +383,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
<Icon icon="arrow-up1" classes="icon-inline" />
{showScores() &&
this.state.upvotes !== this.state.score && (
<span class="ml-1">
<span className="ml-1">
{numToSI(this.state.upvotes)}
</span>
)}
@ -399,14 +402,14 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
<Icon icon="arrow-down1" classes="icon-inline" />
{showScores() &&
this.state.upvotes !== this.state.score && (
<span class="ml-1">
<span className="ml-1">
{numToSI(this.state.downvotes)}
</span>
)}
</button>
)}
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(this, this.handleReplyClick)}
data-tippy-content={i18n.t("reply")}
aria-label={i18n.t("reply")}
@ -426,7 +429,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
<>
{!this.myComment && (
<>
<button class="btn btn-link btn-animate">
<button className="btn btn-link btn-animate">
<Link
className="text-muted"
to={`/create_private_message/recipient/${cv.creator.id}`}
@ -436,7 +439,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
</Link>
</button>
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handleShowReportDialog
@ -449,7 +452,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
<Icon icon="flag" />
</button>
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handleBlockUserClick
@ -462,7 +465,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
</>
)}
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handleSaveCommentClick
@ -501,7 +504,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
{this.myComment && (
<>
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handleEditClick
@ -512,7 +515,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
<Icon icon="edit" classes="icon-inline" />
</button>
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handleDeleteClick
@ -538,7 +541,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
{(canModOnSelf || canAdminOnSelf) && (
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handleDistinguishClick
@ -570,7 +573,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
<>
{!cv.comment.removed ? (
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handleModRemoveShow
@ -581,7 +584,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
</button>
) : (
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handleModRemoveSubmit
@ -599,7 +602,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
{!isMod_ &&
(!cv.creator_banned_from_community ? (
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handleModBanFromCommunityShow
@ -610,7 +613,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
</button>
) : (
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handleModBanFromCommunitySubmit
@ -623,7 +626,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
{!cv.creator_banned_from_community &&
(!this.state.showConfirmAppointAsMod ? (
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handleShowConfirmAppointAsMod
@ -641,13 +644,13 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
) : (
<>
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
aria-label={i18n.t("are_you_sure")}
>
{i18n.t("are_you_sure")}
</button>
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handleAddModToCommunity
@ -657,7 +660,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
{i18n.t("yes")}
</button>
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handleCancelConfirmAppointAsMod
@ -676,7 +679,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
cv.creator.local &&
(!this.state.showConfirmTransferCommunity ? (
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handleShowConfirmTransferCommunity
@ -688,13 +691,13 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
) : (
<>
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
aria-label={i18n.t("are_you_sure")}
>
{i18n.t("are_you_sure")}
</button>
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handleTransferCommunity
@ -704,7 +707,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
{i18n.t("yes")}
</button>
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this
@ -722,7 +725,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
{!isAdmin_ && (
<>
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handlePurgePersonShow
@ -732,7 +735,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
{i18n.t("purge_user")}
</button>
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handlePurgeCommentShow
@ -744,7 +747,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
{!isBanned(cv.creator) ? (
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handleModBanShow
@ -755,7 +758,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
</button>
) : (
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handleModBanSubmit
@ -771,7 +774,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
cv.creator.local &&
(!this.state.showConfirmAppointAsAdmin ? (
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handleShowConfirmAppointAsAdmin
@ -788,11 +791,11 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
</button>
) : (
<>
<button class="btn btn-link btn-animate text-muted">
<button className="btn btn-link btn-animate text-muted">
{i18n.t("are_you_sure")}
</button>
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handleAddAdmin
@ -802,7 +805,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
{i18n.t("yes")}
</button>
<button
class="btn btn-link btn-animate text-muted"
className="btn btn-link btn-animate text-muted"
onClick={linkEvent(
this,
this.handleCancelConfirmAppointAsAdmin
@ -833,7 +836,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
style={`border-left: 2px ${moreRepliesBorderColor} solid !important`}
>
<button
class="btn btn-link text-muted"
className="btn btn-link text-muted"
onClick={linkEvent(this, this.handleFetchChildren)}
>
{i18n.t("x_more_replies", {
@ -847,11 +850,11 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
{/* end of details */}
{this.state.showRemoveDialog && (
<form
class="form-inline"
className="form-inline"
onSubmit={linkEvent(this, this.handleModRemoveSubmit)}
>
<label
class="sr-only"
className="sr-only"
htmlFor={`mod-remove-reason-${cv.comment.id}`}
>
{i18n.t("reason")}
@ -859,14 +862,14 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
<input
type="text"
id={`mod-remove-reason-${cv.comment.id}`}
class="form-control mr-2"
className="form-control mr-2"
placeholder={i18n.t("reason")}
value={toUndefined(this.state.removeReason)}
onInput={linkEvent(this, this.handleModRemoveReasonChange)}
/>
<button
type="submit"
class="btn btn-secondary"
className="btn btn-secondary"
aria-label={i18n.t("remove_comment")}
>
{i18n.t("remove_comment")}
@ -875,24 +878,27 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
)}
{this.state.showReportDialog && (
<form
class="form-inline"
className="form-inline"
onSubmit={linkEvent(this, this.handleReportSubmit)}
>
<label class="sr-only" htmlFor={`report-reason-${cv.comment.id}`}>
<label
className="sr-only"
htmlFor={`report-reason-${cv.comment.id}`}
>
{i18n.t("reason")}
</label>
<input
type="text"
required
id={`report-reason-${cv.comment.id}`}
class="form-control mr-2"
className="form-control mr-2"
placeholder={i18n.t("reason")}
value={this.state.reportReason}
onInput={linkEvent(this, this.handleReportReasonChange)}
/>
<button
type="submit"
class="btn btn-secondary"
className="btn btn-secondary"
aria-label={i18n.t("create_report")}
>
{i18n.t("create_report")}
@ -901,9 +907,9 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
)}
{this.state.showBanDialog && (
<form onSubmit={linkEvent(this, this.handleModBanBothSubmit)}>
<div class="form-group row col-12">
<div className="form-group row col-12">
<label
class="col-form-label"
className="col-form-label"
htmlFor={`mod-ban-reason-${cv.comment.id}`}
>
{i18n.t("reason")}
@ -911,13 +917,13 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
<input
type="text"
id={`mod-ban-reason-${cv.comment.id}`}
class="form-control mr-2"
className="form-control mr-2"
placeholder={i18n.t("reason")}
value={toUndefined(this.state.banReason)}
onInput={linkEvent(this, this.handleModBanReasonChange)}
/>
<label
class="col-form-label"
className="col-form-label"
htmlFor={`mod-ban-expires-${cv.comment.id}`}
>
{i18n.t("expires")}
@ -925,22 +931,22 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
<input
type="number"
id={`mod-ban-expires-${cv.comment.id}`}
class="form-control mr-2"
className="form-control mr-2"
placeholder={i18n.t("number_of_days")}
value={toUndefined(this.state.banExpireDays)}
onInput={linkEvent(this, this.handleModBanExpireDaysChange)}
/>
<div class="form-group">
<div class="form-check">
<div className="form-group">
<div className="form-check">
<input
class="form-check-input"
className="form-check-input"
id="mod-ban-remove-data"
type="checkbox"
checked={this.state.removeData}
onChange={linkEvent(this, this.handleModRemoveDataChange)}
/>
<label
class="form-check-label"
className="form-check-label"
htmlFor="mod-ban-remove-data"
title={i18n.t("remove_content_more")}
>
@ -954,10 +960,10 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
{/* <label class="col-form-label">Expires</label> */}
{/* <input type="date" class="form-control mr-2" placeholder={i18n.t('expires')} value={this.state.banExpires} onInput={linkEvent(this, this.handleModBanExpiresChange)} /> */}
{/* </div> */}
<div class="form-group row">
<div className="form-group row">
<button
type="submit"
class="btn btn-secondary"
className="btn btn-secondary"
aria-label={i18n.t("ban")}
>
{i18n.t("ban")} {cv.creator.name}
@ -969,24 +975,24 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
{this.state.showPurgeDialog && (
<form onSubmit={linkEvent(this, this.handlePurgeSubmit)}>
<PurgeWarning />
<label class="sr-only" htmlFor="purge-reason">
<label className="sr-only" htmlFor="purge-reason">
{i18n.t("reason")}
</label>
<input
type="text"
id="purge-reason"
class="form-control my-3"
className="form-control my-3"
placeholder={i18n.t("reason")}
value={toUndefined(this.state.purgeReason)}
onInput={linkEvent(this, this.handlePurgeReasonChange)}
/>
<div class="form-group row col-12">
<div className="form-group row col-12">
{this.state.purgeLoading ? (
<Spinner />
) : (
<button
type="submit"
class="btn btn-secondary"
className="btn btn-secondary"
aria-label={purgeTypeText}
>
{purgeTypeText}
@ -1015,7 +1021,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
/>
)}
{/* A collapsed clearfix */}
{this.state.collapsed && <div class="row col-12"></div>}
{this.state.collapsed && <div className="row col-12"></div>}
</div>
);
}
@ -1090,13 +1096,11 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
}
handleReplyClick(i: CommentNode) {
i.state.showReply = true;
i.setState(i.state);
i.setState({ showReply: true });
}
handleEditClick(i: CommentNode) {
i.state.showEdit = true;
i.setState(i.state);
i.setState({ showEdit: true });
}
handleBlockUserClick(i: CommentNode) {
@ -1129,14 +1133,11 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
WebSocketService.Instance.send(wsClient.saveComment(form));
i.state.saveLoading = true;
i.setState(this.state);
i.setState({ saveLoading: true });
}
handleReplyCancel() {
this.state.showReply = false;
this.state.showEdit = false;
this.setState(this.state);
this.setState({ showReply: false, showEdit: false });
}
handleCommentUpvote(event: any) {
@ -1145,18 +1146,24 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
let newVote = myVote == 1 ? 0 : 1;
if (myVote == 1) {
this.state.score--;
this.state.upvotes--;
this.setState({
score: this.state.score - 1,
upvotes: this.state.upvotes - 1,
});
} else if (myVote == -1) {
this.state.downvotes--;
this.state.upvotes++;
this.state.score += 2;
this.setState({
downvotes: this.state.downvotes - 1,
upvotes: this.state.upvotes + 1,
score: this.state.score + 2,
});
} else {
this.state.upvotes++;
this.state.score++;
this.setState({
score: this.state.score + 1,
upvotes: this.state.upvotes + 1,
});
}
this.state.my_vote = Some(newVote);
this.setState({ my_vote: Some(newVote) });
let form = new CreateCommentLike({
comment_id: this.props.node.comment_view.comment.id,
@ -1164,7 +1171,6 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
auth: auth().unwrap(),
});
WebSocketService.Instance.send(wsClient.likeComment(form));
this.setState(this.state);
setupTippy();
}
@ -1174,18 +1180,24 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
let newVote = myVote == -1 ? 0 : -1;
if (myVote == 1) {
this.state.score -= 2;
this.state.upvotes--;
this.state.downvotes++;
this.setState({
downvotes: this.state.downvotes + 1,
upvotes: this.state.upvotes - 1,
score: this.state.score - 2,
});
} else if (myVote == -1) {
this.state.downvotes--;
this.state.score++;
this.setState({
downvotes: this.state.downvotes - 1,
score: this.state.score + 1,
});
} else {
this.state.downvotes++;
this.state.score--;
this.setState({
downvotes: this.state.downvotes + 1,
score: this.state.score - 1,
});
}
this.state.my_vote = Some(newVote);
this.setState({ my_vote: Some(newVote) });
let form = new CreateCommentLike({
comment_id: this.props.node.comment_view.comment.id,
@ -1194,18 +1206,15 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
});
WebSocketService.Instance.send(wsClient.likeComment(form));
this.setState(this.state);
setupTippy();
}
handleShowReportDialog(i: CommentNode) {
i.state.showReportDialog = !i.state.showReportDialog;
i.setState(i.state);
i.setState({ showReportDialog: !i.state.showReportDialog });
}
handleReportReasonChange(i: CommentNode, event: any) {
i.state.reportReason = event.target.value;
i.setState(i.state);
i.setState({ reportReason: event.target.value });
}
handleReportSubmit(i: CommentNode) {
@ -1217,24 +1226,22 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
});
WebSocketService.Instance.send(wsClient.createCommentReport(form));
i.state.showReportDialog = false;
i.setState(i.state);
i.setState({ showReportDialog: false });
}
handleModRemoveShow(i: CommentNode) {
i.state.showRemoveDialog = !i.state.showRemoveDialog;
i.state.showBanDialog = false;
i.setState(i.state);
i.setState({
showRemoveDialog: !i.state.showRemoveDialog,
showBanDialog: false,
});
}
handleModRemoveReasonChange(i: CommentNode, event: any) {
i.state.removeReason = Some(event.target.value);
i.setState(i.state);
i.setState({ removeReason: Some(event.target.value) });
}
handleModRemoveDataChange(i: CommentNode, event: any) {
i.state.removeData = event.target.checked;
i.setState(i.state);
i.setState({ removeData: event.target.checked });
}
handleModRemoveSubmit(i: CommentNode) {
@ -1247,8 +1254,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
});
WebSocketService.Instance.send(wsClient.removeComment(form));
i.state.showRemoveDialog = false;
i.setState(i.state);
i.setState({ showRemoveDialog: false });
}
handleDistinguishClick(i: CommentNode) {
@ -1293,43 +1299,40 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
WebSocketService.Instance.send(wsClient.markCommentReplyAsRead(form));
}
i.state.readLoading = true;
i.setState(this.state);
i.setState({ readLoading: true });
}
handleModBanFromCommunityShow(i: CommentNode) {
i.state.showBanDialog = true;
i.state.banType = BanType.Community;
i.state.showRemoveDialog = false;
i.setState(i.state);
i.setState({
showBanDialog: true,
banType: BanType.Community,
showRemoveDialog: false,
});
}
handleModBanShow(i: CommentNode) {
i.state.showBanDialog = true;
i.state.banType = BanType.Site;
i.state.showRemoveDialog = false;
i.setState(i.state);
i.setState({
showBanDialog: true,
banType: BanType.Site,
showRemoveDialog: false,
});
}
handleModBanReasonChange(i: CommentNode, event: any) {
i.state.banReason = Some(event.target.value);
i.setState(i.state);
i.setState({ banReason: Some(event.target.value) });
}
handleModBanExpireDaysChange(i: CommentNode, event: any) {
i.state.banExpireDays = Some(event.target.value);
i.setState(i.state);
i.setState({ banExpireDays: Some(event.target.value) });
}
handleModBanFromCommunitySubmit(i: CommentNode) {
i.state.banType = BanType.Community;
i.setState(i.state);
i.setState({ banType: BanType.Community });
i.handleModBanBothSubmit(i);
}
handleModBanSubmit(i: CommentNode) {
i.state.banType = BanType.Site;
i.setState(i.state);
i.setState({ banType: BanType.Site });
i.handleModBanBothSubmit(i);
}
@ -1340,7 +1343,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
// If its an unban, restore all their data
let ban = !cv.creator_banned_from_community;
if (ban == false) {
i.state.removeData = false;
i.setState({ removeData: false });
}
let form = new BanFromCommunity({
person_id: cv.creator.id,
@ -1356,7 +1359,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
// If its an unban, restore all their data
let ban = !cv.creator.banned;
if (ban == false) {
i.state.removeData = false;
i.setState({ removeData: false });
}
let form = new BanPerson({
person_id: cv.creator.id,
@ -1369,27 +1372,27 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
WebSocketService.Instance.send(wsClient.banPerson(form));
}
i.state.showBanDialog = false;
i.setState(i.state);
i.setState({ showBanDialog: false });
}
handlePurgePersonShow(i: CommentNode) {
i.state.showPurgeDialog = true;
i.state.purgeType = PurgeType.Person;
i.state.showRemoveDialog = false;
i.setState(i.state);
i.setState({
showPurgeDialog: true,
purgeType: PurgeType.Person,
showRemoveDialog: false,
});
}
handlePurgeCommentShow(i: CommentNode) {
i.state.showPurgeDialog = true;
i.state.purgeType = PurgeType.Comment;
i.state.showRemoveDialog = false;
i.setState(i.state);
i.setState({
showPurgeDialog: true,
purgeType: PurgeType.Comment,
showRemoveDialog: false,
});
}
handlePurgeReasonChange(i: CommentNode, event: any) {
i.state.purgeReason = Some(event.target.value);
i.setState(i.state);
i.setState({ purgeReason: Some(event.target.value) });
}
handlePurgeSubmit(i: CommentNode, event: any) {
@ -1411,18 +1414,15 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
WebSocketService.Instance.send(wsClient.purgeComment(form));
}
i.state.purgeLoading = true;
i.setState(i.state);
i.setState({ purgeLoading: true });
}
handleShowConfirmAppointAsMod(i: CommentNode) {
i.state.showConfirmAppointAsMod = true;
i.setState(i.state);
i.setState({ showConfirmAppointAsMod: true });
}
handleCancelConfirmAppointAsMod(i: CommentNode) {
i.state.showConfirmAppointAsMod = false;
i.setState(i.state);
i.setState({ showConfirmAppointAsMod: false });
}
handleAddModToCommunity(i: CommentNode) {
@ -1434,18 +1434,15 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
auth: auth().unwrap(),
});
WebSocketService.Instance.send(wsClient.addModToCommunity(form));
i.state.showConfirmAppointAsMod = false;
i.setState(i.state);
i.setState({ showConfirmAppointAsMod: false });
}
handleShowConfirmAppointAsAdmin(i: CommentNode) {
i.state.showConfirmAppointAsAdmin = true;
i.setState(i.state);
i.setState({ showConfirmAppointAsAdmin: true });
}
handleCancelConfirmAppointAsAdmin(i: CommentNode) {
i.state.showConfirmAppointAsAdmin = false;
i.setState(i.state);
i.setState({ showConfirmAppointAsAdmin: false });
}
handleAddAdmin(i: CommentNode) {
@ -1456,18 +1453,15 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
auth: auth().unwrap(),
});
WebSocketService.Instance.send(wsClient.addAdmin(form));
i.state.showConfirmAppointAsAdmin = false;
i.setState(i.state);
i.setState({ showConfirmAppointAsAdmin: false });
}
handleShowConfirmTransferCommunity(i: CommentNode) {
i.state.showConfirmTransferCommunity = true;
i.setState(i.state);
i.setState({ showConfirmTransferCommunity: true });
}
handleCancelShowConfirmTransferCommunity(i: CommentNode) {
i.state.showConfirmTransferCommunity = false;
i.setState(i.state);
i.setState({ showConfirmTransferCommunity: false });
}
handleTransferCommunity(i: CommentNode) {
@ -1478,18 +1472,15 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
auth: auth().unwrap(),
});
WebSocketService.Instance.send(wsClient.transferCommunity(form));
i.state.showConfirmTransferCommunity = false;
i.setState(i.state);
i.setState({ showConfirmTransferCommunity: false });
}
handleShowConfirmTransferSite(i: CommentNode) {
i.state.showConfirmTransferSite = true;
i.setState(i.state);
i.setState({ showConfirmTransferSite: true });
}
handleCancelShowConfirmTransferSite(i: CommentNode) {
i.state.showConfirmTransferSite = false;
i.setState(i.state);
i.setState({ showConfirmTransferSite: false });
}
get isCommentNew(): boolean {
@ -1499,19 +1490,16 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
}
handleCommentCollapse(i: CommentNode) {
i.state.collapsed = !i.state.collapsed;
i.setState(i.state);
i.setState({ collapsed: !i.state.collapsed });
setupTippy();
}
handleViewSource(i: CommentNode) {
i.state.viewSource = !i.state.viewSource;
i.setState(i.state);
i.setState({ viewSource: !i.state.viewSource });
}
handleShowAdvanced(i: CommentNode) {
i.state.showAdvanced = !i.state.showAdvanced;
i.setState(i.state);
i.setState({ showAdvanced: !i.state.showAdvanced });
setupTippy();
}