import Telescope from 'meteor/nova:lib'; import React, { PropTypes, Component } from 'react'; import { intlShape, FormattedMessage, FormattedRelative } from 'react-intl'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { ShowIf, withCurrentUser } from 'meteor/nova:core'; import Comments from 'meteor/nova:comments'; class CommentsItem extends Component{ constructor() { super(); ['showReply', 'replyCancelCallback', 'replySuccessCallback', 'showEdit', 'editCancelCallback', 'editSuccessCallback', 'removeSuccessCallback'].forEach(methodName => {this[methodName] = this[methodName].bind(this)}); this.state = { showReply: false, showEdit: false }; } showReply(event) { event.preventDefault(); this.setState({showReply: true}); } replyCancelCallback(event) { event.preventDefault(); this.setState({showReply: false}); } replySuccessCallback() { this.setState({showReply: false}); } showEdit(event) { event.preventDefault(); this.setState({showEdit: true}); } editCancelCallback(event) { event.preventDefault(); this.setState({showEdit: false}); } editSuccessCallback() { this.setState({showEdit: false}); } removeSuccessCallback({documentId}) { const deleteDocumentSuccess = this.context.intl.formatMessage({id: 'comments.delete_success'}); this.props.flash(deleteDocumentSuccess, "success"); // todo: handle events in async callback // this.context.events.track("comment deleted", {_id: documentId}); } renderComment() { const htmlBody = {__html: this.props.comment.htmlBody}; const showReplyButton = !this.props.comment.isDeleted && !!this.props.currentUser; return (
) } renderReply() { return (