diff --git a/client/coral-embed-stream/src/CommentStream.js b/client/coral-embed-stream/src/CommentStream.js index 787cba78a..b8ec5c762 100644 --- a/client/coral-embed-stream/src/CommentStream.js +++ b/client/coral-embed-stream/src/CommentStream.js @@ -111,7 +111,8 @@ class CommentStream extends Component { postItem={this.props.postItem} appendItemArray={this.props.appendItemArray} updateItem={this.props.updateItem} - id={rootItemId}/> + id={rootItemId} + reply={false}/> { rootItem.comments.map((commentId) => { @@ -137,7 +138,8 @@ class CommentStream extends Component { postItem={this.props.postItem} appendItemArray={this.props.appendItemArray} updateItem={this.props.updateItem} - id={commentId} + id={rootItemId} + parent_id={commentId} showReply={comment.showReply}/> { comment.children && diff --git a/client/coral-plugin-commentbox/CommentBox.js b/client/coral-plugin-commentbox/CommentBox.js index 1bd138af9..b7d282f10 100644 --- a/client/coral-plugin-commentbox/CommentBox.js +++ b/client/coral-plugin-commentbox/CommentBox.js @@ -19,26 +19,26 @@ class CommentBox extends Component { } postComment = () => { - const {postItem, updateItem, id, reply, addNotification, appendItemArray} = this.props + const {postItem, updateItem, id, parent_id, addNotification, appendItemArray} = this.props let comment = { body: this.state.body, asset_id: id, username: this.state.username } let related - if (reply) { - comment.parent_id = id + if (parent_id) { + comment.parent_id = parent_id related = 'children' } else { related = 'comments' } - updateItem(id, 'showReply', false) + updateItem(parent_id, 'showReply', false) postItem(comment, 'comments') .then((comment_id) => { - appendItemArray(id, related, comment_id) + appendItemArray(parent_id || id, related, comment_id) addNotification('success', 'Your comment has been posted.') }).catch((err) => console.error(err)) - this.setState({content: ''}) + this.setState({body: ''}) } render () { @@ -49,7 +49,7 @@ class CommentBox extends Component { this.setState({username: e.target.value})}/> @@ -65,7 +65,7 @@ class CommentBox extends Component {