Pass current user to CommentBox

This commit is contained in:
Chi Vinh Le
2017-06-27 22:14:06 +07:00
parent 500d5d582e
commit b67ac375ba
4 changed files with 7 additions and 7 deletions
@@ -557,8 +557,8 @@ export default class Comment extends React.Component {
setActiveReplyBox={setActiveReplyBox}
parentId={parentId || comment.id}
addNotification={addNotification}
authorId={currentUser.id}
postComment={postComment}
currentUser={currentUser}
assetId={asset.id}
/>
: null}
@@ -224,7 +224,7 @@ class Stream extends React.Component {
assetId={asset.id}
premod={asset.settings.moderation}
isReply={false}
authorId={user.id}
currentUser={user}
charCountEnable={asset.settings.charCountEnable}
maxCharCount={asset.settings.charCount}
/>}
+3 -3
View File
@@ -133,7 +133,7 @@ class CommentBox extends React.Component {
handleChange = (e) => this.setState({body: e.target.value});
render () {
const {styles, isReply, authorId, maxCharCount} = this.props;
const {styles, isReply, currentUser, maxCharCount} = this.props;
let {cancelButtonClicked} = this.props;
if (isReply && typeof cancelButtonClicked !== 'function') {
@@ -152,7 +152,7 @@ class CommentBox extends React.Component {
charCountEnable={this.props.charCountEnable}
bodyPlaceholder={t('comment.comment')}
bodyInputId={isReply ? 'replyText' : 'commentText'}
saveComment={authorId && this.postComment}
saveComment={currentUser && this.postComment}
buttonContainerStart={<Slot
fill="commentInputDetailArea"
registerHook={this.registerHook}
@@ -177,7 +177,7 @@ CommentBox.propTypes = {
cancelButtonClicked: PropTypes.func,
assetId: PropTypes.string.isRequired,
parentId: PropTypes.string,
authorId: PropTypes.string.isRequired,
currentUser: PropTypes.object.isRequired,
isReply: PropTypes.bool.isRequired,
canPost: PropTypes.bool,
};
+2 -2
View File
@@ -18,7 +18,7 @@ class ReplyBox extends Component {
styles,
postComment,
assetId,
authorId,
currentUser,
addNotification,
parentId,
commentPostedHandler,
@@ -33,7 +33,7 @@ class ReplyBox extends Component {
parentId={parentId}
cancelButtonClicked={this.cancelReply}
addNotification={addNotification}
authorId={authorId}
currentUser={currentUser}
assetId={assetId}
postComment={postComment}
isReply={true} />