import Telescope from 'meteor/nova:lib';
import React from 'react';
import {FormattedMessage } from 'react-intl';
import { ModalTrigger, withCurrentUser, withList } from 'meteor/nova:core';
import Comments from 'meteor/nova:comments';
const PostsCommentsThread = (props, context) => {
const {loading, postId, results} = props;
if (loading) {
return
} else {
const commentCount = results.length;
const resultsClone = _.map(results, _.clone); // we don't want to modify the objects we got from props
const nestedComments = Telescope.utils.unflatten(resultsClone, '_id', 'parentCommentId');
return (
{ props.currentUser ?
:
}>
}
);
}
};
PostsCommentsThread.displayName = "PostsCommentsThread";
PostsCommentsThread.propTypes = {
currentUser: React.PropTypes.object
};
const commentsListOptions = {
collection: Comments,
options: {
variables: {
postId: {
type: 'String',
usedForTotal: true
}
}
},
};
Telescope.registerComponent('PostsCommentsThread', PostsCommentsThread, withCurrentUser);
// Telescope.registerComponent('PostsCommentsThread', PostsCommentsThread, withCurrentUser, withList(commentsListOptions));