2016-08-08 11:18:21 +09:00
|
|
|
import Telescope from 'meteor/nova:lib';
|
2016-04-19 15:45:36 +09:00
|
|
|
import React from 'react';
|
2016-06-09 17:42:20 +09:00
|
|
|
import {FormattedMessage } from 'react-intl';
|
2016-05-22 15:23:30 +09:00
|
|
|
import { ModalTrigger } from "meteor/nova:core";
|
2016-06-23 12:17:39 +09:00
|
|
|
import Comments from "meteor/nova:comments";
|
2016-04-19 15:45:36 +09:00
|
|
|
|
2016-11-07 23:46:12 +09:00
|
|
|
const PostsCommentsThread = (props, context) => {
|
2016-04-19 15:45:36 +09:00
|
|
|
|
2016-11-07 16:33:52 +01:00
|
|
|
// the error starts below because of comments instead of results
|
2016-11-07 23:52:39 +09:00
|
|
|
const {postId, results, totalCount} = props;
|
2016-04-19 15:45:36 +09:00
|
|
|
|
2016-11-07 16:33:52 +01:00
|
|
|
// this is how I managed to get the error not swallowed
|
|
|
|
try {
|
|
|
|
return (
|
|
|
|
<div className="posts-comments-thread">
|
|
|
|
<h4 className="posts-comments-thread-title"><FormattedMessage id="comments.comments"/></h4>
|
|
|
|
<Telescope.components.CommentstsList comments={comments} /> {/* this breaks everything */}
|
|
|
|
{ context.currentUser ?
|
|
|
|
<div className="posts-comments-thread-new">
|
|
|
|
<h4><FormattedMessage id="comments.new"/></h4>
|
|
|
|
<Telescope.components.CommentsNewForm
|
|
|
|
postId={post._id}
|
|
|
|
type="comment"
|
|
|
|
/>
|
|
|
|
</div> :
|
|
|
|
<div>
|
|
|
|
<ModalTrigger size="small" component={<a><FormattedMessage id="comments.please_log_in"/></a>}>
|
|
|
|
<Telescope.components.UsersAccountForm/>
|
|
|
|
</ModalTrigger>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
} catch(e) {
|
|
|
|
console.log(e); // Ah ha! I got you! 🤕
|
|
|
|
return <div>error</div>
|
|
|
|
}
|
2016-04-19 15:45:36 +09:00
|
|
|
};
|
|
|
|
|
2016-05-22 16:42:24 +09:00
|
|
|
PostsCommentsThread.displayName = "PostsCommentsThread";
|
|
|
|
|
2016-10-14 08:47:18 +02:00
|
|
|
PostsCommentsThread.contextTypes = {
|
|
|
|
currentUser: React.PropTypes.object
|
|
|
|
};
|
|
|
|
|
2016-04-19 15:45:36 +09:00
|
|
|
module.exports = PostsCommentsThread;
|
|
|
|
export default PostsCommentsThread;
|