]> Untitled Git - lemmy.git/commitdiff
Adding delete comment
authorDessalines <tyhou13@gmx.com>
Fri, 29 Mar 2019 06:03:17 +0000 (23:03 -0700)
committerDessalines <tyhou13@gmx.com>
Fri, 29 Mar 2019 06:03:17 +0000 (23:03 -0700)
- Fixes #9

ui/src/components/post.tsx

index c5c8a53fc20334fdee61b756890cfc4d5b2074e9..1cd61ea31020aed9c6ac5ad2a55945db5b0cffcd 100644 (file)
@@ -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;