From 8020213da538bf38a09787d5e7c7bfe76d56b067 Mon Sep 17 00:00:00 2001 From: David Jay Date: Wed, 2 Nov 2016 15:37:58 -0700 Subject: [PATCH] Updating commentStream to reflect new data structure --- .../coral-embed-stream/src/CommentStream.js | 39 +++++++++---------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/client/coral-embed-stream/src/CommentStream.js b/client/coral-embed-stream/src/CommentStream.js index 28d35860d..dad8fbbf9 100644 --- a/client/coral-embed-stream/src/CommentStream.js +++ b/client/coral-embed-stream/src/CommentStream.js @@ -14,7 +14,7 @@ import Flag from '../../coral-plugin-flags/FlagButton' import {ReplyBox, ReplyButton} from '../../coral-plugin-replies' import Pym from 'pym.js' -const {addItem, updateItem, postItem, getItemsQuery, postAction, appendItemRelated} = itemActions +const {addItem, updateItem, postItem, getStream, postAction, appendItemArray} = itemActions const {addNotification, clearNotification} = notificationActions const {setLoggedInUser} = authActions @@ -38,8 +38,8 @@ const {setLoggedInUser} = authActions postItem: (data, type, id) => { return dispatch(postItem(data, type, id)) }, - getItemsQuery: (rootId) => { - return dispatch(getItemsQuery(rootId)) + getStream: (rootId) => { + return dispatch(getStream(rootId)) }, addNotification: (type, text) => { return dispatch(addNotification(type, text)) @@ -53,8 +53,8 @@ const {setLoggedInUser} = authActions postAction: (item, action, user) => { return dispatch(postAction(item, action, user)) }, - appendItemRelated: (item, property, value) => { - return dispatch(appendItemRelated(item, property, value)) + appendItemArray: (item, property, value) => { + return dispatch(appendItemArray(item, property, value)) } } } @@ -72,7 +72,7 @@ class CommentStream extends Component { // Set up messaging between embedded Iframe an parent component // Using recommended Pym init code which violates .eslint standards new Pym.Child({ polling: 500 }) - this.props.getItemsQuery('assetTest') + this.props.getStream('assetTest') } render () { @@ -104,53 +104,52 @@ class CommentStream extends Component {
+ id={rootItemId}/>
{ - rootItem.related.comment.map((commentId) => { + rootItem.comments.map((commentId) => { const comment = this.props.items[commentId] return

- +
+ id={commentId}/>
{ - comment.related && - comment.related.child && - comment.related.child.map((replyId) => { + comment.children && + comment.children.map((replyId) => { let reply = this.props.items[replyId] return

- +