diff --git a/ui/src/components/comment-node.tsx b/ui/src/components/comment-node.tsx index 34ec0dfb..b3ca682b 100644 --- a/ui/src/components/comment-node.tsx +++ b/ui/src/components/comment-node.tsx @@ -42,6 +42,8 @@ interface CommentNodeState { banType: BanType; showConfirmTransferSite: boolean; showConfirmTransferCommunity: boolean; + showConfirmAppointAsMod: boolean; + showConfirmAppointAsAdmin: boolean; collapsed: boolean; viewSource: boolean; } @@ -71,6 +73,8 @@ export class CommentNode extends Component { viewSource: false, showConfirmTransferSite: false, showConfirmTransferCommunity: false, + showConfirmAppointAsMod: false, + showConfirmAppointAsAdmin: false, }; constructor(props: any, context: any) { @@ -206,6 +210,18 @@ export class CommentNode extends Component { /> )} )} @@ -725,13 +788,13 @@ export class CommentNode extends Component { } handleModBanFromCommunityShow(i: CommentNode) { - i.state.showBanDialog = true; + i.state.showBanDialog = !i.state.showBanDialog; i.state.banType = BanType.Community; i.setState(i.state); } handleModBanShow(i: CommentNode) { - i.state.showBanDialog = true; + i.state.showBanDialog = !i.state.showBanDialog; i.state.banType = BanType.Site; i.setState(i.state); } @@ -784,6 +847,16 @@ export class CommentNode extends Component { i.setState(i.state); } + handleShowConfirmAppointAsMod(i: CommentNode) { + i.state.showConfirmAppointAsMod = true; + i.setState(i.state); + } + + handleCancelConfirmAppointAsMod(i: CommentNode) { + i.state.showConfirmAppointAsMod = false; + i.setState(i.state); + } + handleAddModToCommunity(i: CommentNode) { let form: AddModToCommunityForm = { user_id: i.props.node.comment.creator_id, @@ -791,6 +864,17 @@ export class CommentNode extends Component { added: !i.isMod, }; WebSocketService.Instance.addModToCommunity(form); + i.state.showConfirmAppointAsMod = false; + i.setState(i.state); + } + + handleShowConfirmAppointAsAdmin(i: CommentNode) { + i.state.showConfirmAppointAsAdmin = true; + i.setState(i.state); + } + + handleCancelConfirmAppointAsAdmin(i: CommentNode) { + i.state.showConfirmAppointAsAdmin = false; i.setState(i.state); } @@ -800,6 +884,7 @@ export class CommentNode extends Component { added: !i.isAdmin, }; WebSocketService.Instance.addAdmin(form); + i.state.showConfirmAppointAsAdmin = false; i.setState(i.state); }