Skip to content

Instantly share code, notes, and snippets.

@colinta
Created April 11, 2016 21:35
Show Gist options
  • Save colinta/8d73822c5ba4ce7efa78b7b25ae93499 to your computer and use it in GitHub Desktop.
Save colinta/8d73822c5ba4ce7efa78b7b25ae93499 to your computer and use it in GitHub Desktop.
diff --git a/src/components/posts/PostTools.js b/src/components/posts/PostTools.js
index b69f64f..a9b04cb 100644
--- a/src/components/posts/PostTools.js
+++ b/src/components/posts/PostTools.js
@@ -172,9 +172,13 @@ class PostTools extends Component {
};
toggleComments = () => {
- const { dispatch, post } = this.props
+ const { author, dispatch, isLoggedIn, post } = this.props
+ if (isLoggedIn) {
const showComments = !post.showComments
dispatch(postActions.toggleComments(post, showComments))
+ } else {
+ dispatch(routeActions.push(`/${author.username}/post/${post.token}`))
+ }
};
lovePost = () => {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment