hide reply button if stream is closed

This commit is contained in:
riley
2017-03-20 13:01:38 -06:00
parent 471a55c3eb
commit d7e554a055
3 changed files with 18 additions and 9 deletions
+12 -7
View File
@@ -43,6 +43,7 @@ class Comment extends React.Component {
// id of currently opened ReplyBox. tracked in Stream.js
activeReplyBox: PropTypes.string.isRequired,
disableReply: PropTypes.bool,
setActiveReplyBox: PropTypes.func.isRequired,
showSignInDialog: PropTypes.func.isRequired,
postFlag: PropTypes.func.isRequired,
@@ -109,6 +110,7 @@ class Comment extends React.Component {
deleteAction,
addCommentTag,
removeCommentTag,
disableReply,
} = this.props;
const like = getActionSummary('LikeActionSummary', comment);
@@ -166,13 +168,16 @@ class Comment extends React.Component {
showSignInDialog={showSignInDialog}
currentUser={currentUser} />
</ActionButton>
<ActionButton>
<ReplyButton
onClick={() => setActiveReplyBox(comment.id)}
parentCommentId={parentId || comment.id}
currentUserId={currentUser && currentUser.id}
banned={false} />
</ActionButton>
{
!disableReply &&
<ActionButton>
<ReplyButton
onClick={() => setActiveReplyBox(comment.id)}
parentCommentId={parentId || comment.id}
currentUserId={currentUser && currentUser.id}
banned={false} />
</ActionButton>
}
<ActionButton>
<IfUserCanModifyBest user={currentUser}>
<BestButton
+1
View File
@@ -202,6 +202,7 @@ class Embed extends Component {
/>
<div className="embed__stream">
<Stream
open={openStream}
addNotification={this.props.addNotification}
postItem={this.props.postItem}
setActiveReplyBox={this.setActiveReplyBox}
+5 -2
View File
@@ -8,6 +8,7 @@ class Stream extends React.Component {
addNotification: PropTypes.func.isRequired,
postItem: PropTypes.func.isRequired,
asset: PropTypes.object.isRequired,
open: PropTypes.bool.isRequired,
comments: PropTypes.array.isRequired,
currentUser: PropTypes.shape({
username: PropTypes.string,
@@ -15,10 +16,10 @@ class Stream extends React.Component {
}),
// dispatch action to add a tag to a comment
addCommentTag: React.PropTypes.func,
addCommentTag: PropTypes.func,
// dispatch action to remove a tag from a comment
removeCommentTag: React.PropTypes.func,
removeCommentTag: PropTypes.func,
}
constructor(props) {
@@ -55,6 +56,7 @@ class Stream extends React.Component {
addNotification,
postFlag,
postLike,
open,
postDontAgree,
loadMore,
deleteAction,
@@ -68,6 +70,7 @@ class Stream extends React.Component {
{
comments.map(comment =>
<Comment
disableReply={!open}
setActiveReplyBox={this.props.setActiveReplyBox}
activeReplyBox={this.props.activeReplyBox}
addNotification={addNotification}