import React, {PropTypes} from 'react'; import {Button} from 'coral-ui'; import LoadMore from './LoadMore'; import NewCount from './NewCount'; import Comment from '../containers/Comment'; import InfoBox from 'coral-plugin-infobox/InfoBox'; import {ModerationLink} from 'coral-plugin-moderation'; import CommentBox from 'coral-plugin-commentbox/CommentBox'; import QuestionBox from 'coral-plugin-questionbox/QuestionBox'; import IgnoredCommentTombstone from './IgnoredCommentTombstone'; import SuspendedAccount from './SuspendedAccount'; import RestrictedMessageBox from 'coral-framework/components/RestrictedMessageBox'; import {can} from 'coral-framework/services/perms'; import ChangeUsernameContainer from 'coral-sign-in/containers/ChangeUsernameContainer'; import I18n from 'coral-framework/modules/i18n/i18n'; import translations from 'coral-framework/translations'; const lang = new I18n(translations); class Stream extends React.Component { setActiveReplyBox = (reactKey) => { if (!this.props.auth.user) { this.props.showSignInDialog(); } else { this.props.setActiveReplyBox(reactKey); } }; render() { const { root: {asset, asset: {comments}, comment, me}, postComment, addNotification, postFlag, postDontAgree, loadMore, deleteAction, showSignInDialog, addTag, removeTag, pluginProps, ignoreUser, auth: {loggedIn, user}, commentCountCache, editName } = this.props; const open = asset.closedAt === null; // even though the permalinked comment is the highlighted one, we're displaying its parent + replies const highlightedComment = comment && comment.parent ? comment.parent : comment; const banned = user && user.status === 'BANNED'; const temporarilySuspended = user && user.suspension.until && new Date(user.suspension.until) > new Date(); const hasOlderComments = !!(asset && asset.lastComment && asset.lastComment.id !== asset.comments[asset.comments.length - 1].id); // Find the created_at date of the first comment. If no comments exist, set the date to a week ago. const firstCommentDate = asset.comments[0] ? asset.comments[0].created_at : new Date(Date.now() - 1000 * 60 * 60 * 24 * 7).toISOString(); const commentIsIgnored = (comment) => { return me && me.ignoredUsers && me.ignoredUsers.find((u) => u.id === comment.user.id); }; return (
{asset.settings.closedMessage}
} {!loggedIn && } {loggedIn && user &&