From 840e0d0ef6a5e5d4d7c7ca967faf0d616bc1de0e Mon Sep 17 00:00:00 2001 From: David Jay Date: Tue, 24 Jan 2017 14:00:16 -0500 Subject: [PATCH] Re-adding buttons when the user is not logged in and showing login if a non-logged-in user clicks 'Reply.' --- client/coral-embed-stream/src/Comment.js | 29 +++++++++++------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/client/coral-embed-stream/src/Comment.js b/client/coral-embed-stream/src/Comment.js index 1310358fe..e90bcd5cb 100644 --- a/client/coral-embed-stream/src/Comment.js +++ b/client/coral-embed-stream/src/Comment.js @@ -60,6 +60,15 @@ class Comment extends React.Component { }).isRequired } + onReplyBoxClick = () => { + if (this.props.currentUser) { + this.setState({replyBoxVisible: !this.state.replyBoxVisible}); + } else { + const offset = document.getElementById(`c_${this.props.comment.id}`).getBoundingClientRect().top - 75; + this.props.showSignInDialog(offset); + } + } + render () { const { comment, @@ -95,16 +104,11 @@ class Comment extends React.Component { currentUser={currentUser}/> - - { - currentUser - ?
+
{ - this.setState({replyBoxVisible: !this.state.replyBoxVisible}); - }} + onClick={this.onReplyBoxClick} parentCommentId={parentId || comment.id} - currentUserId={currentUser.id} + currentUserId={currentUser && currentUser.id} banned={false} />
- : null - }
- { - currentUser - ? - : null - } -
{