re-enable comment nesting

This commit is contained in:
Sacha Greif 2016-11-09 11:55:12 +09:00
parent 80bf6ddb12
commit cab93c1128
4 changed files with 15 additions and 12 deletions

View file

@ -10,23 +10,23 @@ class CommentsNode extends Component {
)
}
// renderChildren(children) {
// return (
// <div className="comments-children">
// {children.map(comment => <CommentsNode comment={comment} key={comment._id} currentUser={this.props.currentUser}/>)}
// </div>
// )
// }
renderChildren(children) {
return (
<div className="comments-children">
{children.map(comment => <CommentsNode comment={comment} key={comment._id} currentUser={this.props.currentUser}/>)}
</div>
)
}
render() {
const comment = this.props.comment;
//const children = this.props.comment.childrenResults;
const children = this.props.comment.childrenResults;
return (
<div className="comments-node">
{this.renderComment(comment)}
{/*children ? this.renderChildren(children) : ""*/}
{children ? this.renderChildren(children) : null}
</div>
)
}

View file

@ -8,10 +8,12 @@ const PostsCommentsThread = (props, context) => {
const {postId, results, commentCount} = props;
const nestedComments = Telescope.utils.unflatten(results, '_id', 'parentCommentId');
return (
<div className="posts-comments-thread">
<h4 className="posts-comments-thread-title"><FormattedMessage id="comments.comments"/></h4>
<Telescope.components.CommentsList comments={results} commentCount={commentCount}/>
<Telescope.components.CommentsList comments={nestedComments} commentCount={commentCount}/>
{ context.currentUser ?
<div className="posts-comments-thread-new">
<h4><FormattedMessage id="comments.new"/></h4>

View file

@ -25,7 +25,8 @@ const UsersProfileCheckModal = ({show, router}, {currentUser}) => {
<NovaForm
collection={ Users }
document={ currentUser }
methodName="users.edit"
mutationName="usersEdit"
resultQuery={Users.graphQLQueries.single}
successCallback={ (user) => Telescope.callbacks.runAsync("users.profileCompleted.async", user) }
fields={ requiredFields }
/>

View file

@ -33,7 +33,7 @@ const resolvers = {
Query: {
comments(root, {postId}, context) {
const options = {
limit: 5,
// limit: 5, // no limit for now
fields: context.getViewableFields(context.currentUser, context.Comments)
}
return context.Comments.find({postId: postId}, options).fetch();