summaryrefslogtreecommitdiffstats
path: root/ui/src/components/post.tsx
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2019-03-28 23:03:17 -0700
committerDessalines <tyhou13@gmx.com>2019-03-28 23:03:17 -0700
commit743390113a7f2f95209acabbdc6c9aeb92b08008 (patch)
tree0286c8749cdc83c87dbfb069fc0ef7059a33da37 /ui/src/components/post.tsx
parent1e12e03cc825237899d09b3bc8afbdb37fa7e507 (diff)
Adding delete comment
- Fixes #9
Diffstat (limited to 'ui/src/components/post.tsx')
-rw-r--r--ui/src/components/post.tsx16
1 files changed, 16 insertions, 0 deletions
diff --git a/ui/src/components/post.tsx b/ui/src/components/post.tsx
index c5c8a53f..1cd61ea3 100644
--- a/ui/src/components/post.tsx
+++ b/ui/src/components/post.tsx
@@ -267,6 +267,11 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
<span class="pointer" onClick={linkEvent(this, this.handleEditClick)}>edit</span>
</li>
}
+ {this.myComment &&
+ <li className="list-inline-item">
+ <span class="pointer" onClick={linkEvent(this, this.handleDeleteClick)}>delete</span>
+ </li>
+ }
<li className="list-inline-item">
<a className="text-muted" href="test">link</a>
</li>
@@ -294,6 +299,17 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
i.setState(i.state);
}
+ handleDeleteClick(i: CommentNode, event) {
+ let deleteForm: CommentFormI = {
+ content: "*deleted*",
+ edit_id: i.props.node.comment.id,
+ post_id: i.props.node.comment.post_id,
+ parent_id: i.props.node.comment.parent_id,
+ auth: null
+ };
+ WebSocketService.Instance.editComment(deleteForm);
+ }
+
handleReplyCancel(): any {
this.state.showReply = false;
this.state.showEdit = false;