- if (this.props.edit) {
- const form: EditComment = {
- content,
- form_id: this.state.formId,
- comment_id: node.comment_view.comment.id,
- language_id,
- auth,
- };
- WebSocketService.Instance.send(wsClient.editComment(form));
- } else {
- const form: CreateComment = {
- content,
- form_id: this.state.formId,
- post_id: node.comment_view.post.id,
- parent_id: node.comment_view.comment.id,
- language_id,
- auth,
- };
- WebSocketService.Instance.send(wsClient.createComment(form));
- }
- }
- }
- }
-
- handleReplyCancel() {
- this.props.onReplyCancel?.();
- }
-
- parseMessage(msg: any) {
- const op = wsUserOp(msg);
- console.log(msg);
-
- // Only do the showing and hiding if logged in
- if (UserService.Instance.myUserInfo) {
- if (
- op == UserOperation.CreateComment ||
- op == UserOperation.EditComment
- ) {
- const data = wsJsonToRes<CommentResponse>(msg);
-
- // This only finishes this form, if the randomly generated form_id matches the one received
- if (this.state.formId && this.state.formId == data.form_id) {
- this.setState({ finished: true });
-
- // Necessary because it broke tribute for some reason
- this.setState({ finished: false });
- }
+ const post_id = node.comment_view.post.id;
+ const parent_id = node.comment_view.comment.id;
+ this.props.onUpsertComment({
+ content,
+ parent_id,
+ post_id,
+ form_id,
+ language_id,
+ auth: myAuthRequired(),
+ });