import React from 'react';
import { FormattedMessage } from 'react-intl';
import { ModalTrigger, withList, withCurrentUser, Components, registerComponent, Utils } from 'meteor/vulcan:core';
import Comments from 'meteor/vulcan:comments';
const PostsCommentsThread = (props, context) => {
const {loading, terms: { postId }, results, totalCount} = props;
if (loading) {
return
} else {
const resultsClone = _.map(results, _.clone); // we don't want to modify the objects we got from props
const nestedComments = Utils.unflatten(resultsClone, '_id', 'parentCommentId');
return (
{!!props.currentUser ?
:
}>
}
);
}
};
PostsCommentsThread.displayName = "PostsCommentsThread";
PostsCommentsThread.propTypes = {
currentUser: React.PropTypes.object
};
const options = {
collection: Comments,
queryName: 'commentsListQuery',
fragmentName: 'CommentsList',
limit: 0,
};
registerComponent('PostsCommentsThread', PostsCommentsThread, [withList, options], withCurrentUser);