diff --git a/client/coral-embed-stream/src/CommentStream.js b/client/coral-embed-stream/src/CommentStream.js
index 0804530e8..3a1acbbc6 100644
--- a/client/coral-embed-stream/src/CommentStream.js
+++ b/client/coral-embed-stream/src/CommentStream.js
@@ -30,11 +30,11 @@ const {setLoggedInUser} = authActions
},
(dispatch) => {
return {
- addItem: (item) => {
- return dispatch(addItem(item))
+ addItem: (item, itemType) => {
+ return dispatch(addItem(item, itemType))
},
- updateItem: (id, property, value) => {
- return dispatch(updateItem(id, property, value))
+ updateItem: (id, property, value, itemType) => {
+ return dispatch(updateItem(id, property, value, itemType))
},
postItem: (data, type, id) => {
return dispatch(postItem(data, type, id))
@@ -54,8 +54,8 @@ const {setLoggedInUser} = authActions
postAction: (item, action, user) => {
return dispatch(postAction(item, action, user))
},
- appendItemArray: (item, property, value, addToFront) => {
- return dispatch(appendItemArray(item, property, value, addToFront))
+ appendItemArray: (item, property, value, addToFront, itemType) => {
+ return dispatch(appendItemArray(item, property, value, addToFront, itemType))
}
}
}
@@ -97,7 +97,7 @@ class CommentStream extends Component {
const rootItemId = 'assetTest'
- const rootItem = this.props.items[rootItemId]
+ const rootItem = this.props.items.assets && this.props.items.assets[rootItemId]
return
{
rootItem ?
@@ -116,7 +116,7 @@ class CommentStream extends Component {
{
rootItem.comments.map((commentId) => {
- const comment = this.props.items[commentId]
+ const comment = this.props.items.comments[commentId]
return
@@ -144,7 +144,7 @@ class CommentStream extends Component {
{
comment.children &&
comment.children.map((replyId) => {
- let reply = this.props.items[replyId]
+ let reply = this.props.items.comments[replyId]
return
diff --git a/client/coral-plugin-commentbox/CommentBox.js b/client/coral-plugin-commentbox/CommentBox.js
index 0f1578859..f6f8a7276 100644
--- a/client/coral-plugin-commentbox/CommentBox.js
+++ b/client/coral-plugin-commentbox/CommentBox.js
@@ -25,17 +25,20 @@ class CommentBox extends Component {
asset_id: id,
username: this.state.username
}
- let related
+ let related;
+ let parent_type;
if (parent_id) {
comment.parent_id = parent_id
related = 'children'
+ parent_type = 'comments'
} else {
related = 'comments'
+ parent_type = 'assets'
}
- updateItem(parent_id, 'showReply', false)
+ updateItem(parent_id, 'showReply', false, 'comments')
postItem(comment, 'comments')
.then((comment_id) => {
- appendItemArray(parent_id || id, related, comment_id, parent_id ? false : true)
+ appendItemArray(parent_id || id, related, comment_id, parent_id ? false : true, parent_type)
addNotification('success', 'Your comment has been posted.')
}).catch((err) => console.error(err))
this.setState({body: ''})
diff --git a/client/coral-plugin-replies/ReplyButton.js b/client/coral-plugin-replies/ReplyButton.js
index 157d24aaf..d0c10355b 100644
--- a/client/coral-plugin-replies/ReplyButton.js
+++ b/client/coral-plugin-replies/ReplyButton.js
@@ -5,7 +5,7 @@ const name = 'coral-plugin-replies'
const ReplyButton = (props) =>