From a0db48ea224059905ab79c27980346d384c3817c Mon Sep 17 00:00:00 2001 From: David Jay Date: Fri, 18 Nov 2016 13:10:59 -0500 Subject: [PATCH] Adding author id to posted comments. --- client/coral-embed-stream/src/CommentStream.js | 2 +- client/coral-plugin-commentbox/CommentBox.js | 11 ++++++----- swagger.yaml | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/client/coral-embed-stream/src/CommentStream.js b/client/coral-embed-stream/src/CommentStream.js index cb5fcd89a..7d8669d38 100644 --- a/client/coral-embed-stream/src/CommentStream.js +++ b/client/coral-embed-stream/src/CommentStream.js @@ -105,7 +105,7 @@ class CommentStream extends Component { id={rootItemId} premod={this.props.config.moderation} reply={false} - canPost={loggedIn} + authorId={user.id} /> {!loggedIn && } diff --git a/client/coral-plugin-commentbox/CommentBox.js b/client/coral-plugin-commentbox/CommentBox.js index e712d8e24..be03177f8 100644 --- a/client/coral-plugin-commentbox/CommentBox.js +++ b/client/coral-plugin-commentbox/CommentBox.js @@ -12,7 +12,8 @@ class CommentBox extends Component { id: PropTypes.string, comments: PropTypes.array, reply: PropTypes.bool, - canPost: PropTypes.bool + canPost: PropTypes.bool, + currentUser: PropTypes.object } state = { @@ -21,11 +22,11 @@ class CommentBox extends Component { } postComment = () => { - const {postItem, updateItem, id, parent_id, addNotification, appendItemArray, premod} = this.props; + const {postItem, updateItem, id, parent_id, addNotification, appendItemArray, premod, authorId} = this.props; let comment = { body: this.state.body, asset_id: id, - username: this.state.username + user_id: authorId.id }; let related; let parent_type; @@ -52,7 +53,7 @@ class CommentBox extends Component { } render () { - const {styles, reply, canPost} = this.props; + const {styles, reply, authorId} = this.props; // How to handle language in plugins? Should we have a dependency on our central translation file? return
- { canPost && ( + { authorId && (