import React from 'react'; import PropTypes from 'prop-types'; import {StreamError} from './StreamError'; import Comment from '../containers/Comment'; import SuspendedAccount from './SuspendedAccount'; import Slot from 'coral-framework/components/Slot'; import InfoBox from 'talk-plugin-infobox/InfoBox'; import {can} from 'coral-framework/services/perms'; import {ModerationLink} from 'talk-plugin-moderation'; import RestrictedMessageBox from 'coral-framework/components/RestrictedMessageBox'; import t, {timeago} from 'coral-framework/services/i18n'; import CommentBox from 'talk-plugin-commentbox/CommentBox'; import QuestionBox from 'talk-plugin-questionbox/QuestionBox'; import {isCommentActive} from 'coral-framework/utils'; import {Button, Tab, TabCount, TabPane} from 'coral-ui'; import cn from 'classnames'; import {getTopLevelParent, attachCommentToParent} from '../graphql/utils'; import AllCommentsPane from './AllCommentsPane'; import AutomaticAssetClosure from '../containers/AutomaticAssetClosure'; import StreamTabPanel from '../containers/StreamTabPanel'; import styles from './Stream.css'; class Stream extends React.Component { constructor(props) { super(props); this.state = { keepCommentBox: false, }; } componentWillReceiveProps(next) { // Keep comment box when user was live suspended, banned, ... if (!this.props.userIsDegraged && next.userIsDegraged) { this.setState({keepCommentBox: true}); } } renderHighlightedComment() { const { data, root, activeReplyBox, setActiveReplyBox, commentClassNames, root: {asset, asset: {comment}}, postComment, notify, editComment, postFlag, postDontAgree, deleteAction, showSignInDialog, loadNewReplies, auth: {user}, emit, } = this.props; // even though the permalinked comment is the highlighted one, we're displaying its parent + replies let topLevelComment = getTopLevelParent(comment); if (topLevelComment) { // Inactive comments can be viewed by moderators and admins (e.g. using permalinks). const isInactive = !isCommentActive(comment.status); if (comment.parent && isInactive) { // the highlighted comment is not active and as such not in the replies, so we // attach it to the right parent. topLevelComment = attachCommentToParent(topLevelComment, comment); } } return (
{asset.settings.closedMessage}
}