diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-06-23 16:21:52 -0400 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2017-06-23 16:21:52 -0400 |
commit | 458d7d0021b957a480c4c3c947c6a745da9711b4 (patch) | |
tree | 477a94471fa1117644eafd67cc935289f41e5da8 /webapp/components/post_view/post/index.js | |
parent | a077cae27985583aa4398ae29ffb25705dc352f9 (diff) | |
download | chat-458d7d0021b957a480c4c3c947c6a745da9711b4.tar.gz chat-458d7d0021b957a480c4c3c947c6a745da9711b4.tar.bz2 chat-458d7d0021b957a480c4c3c947c6a745da9711b4.zip |
Fix JS error from null posts (#6722)
Diffstat (limited to 'webapp/components/post_view/post/index.js')
-rw-r--r-- | webapp/components/post_view/post/index.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/webapp/components/post_view/post/index.js b/webapp/components/post_view/post/index.js index 1e195f920..2e7125f34 100644 --- a/webapp/components/post_view/post/index.js +++ b/webapp/components/post_view/post/index.js @@ -12,12 +12,13 @@ import {Preferences} from 'utils/constants.jsx'; import Post from './post.jsx'; function mapStateToProps(state, ownProps) { - const detailedPost = ownProps.post; + const detailedPost = ownProps.post || {}; + return { post: getPost(state, detailedPost.id), lastPostCount: ownProps.lastPostCount, - user: getUser(state, ownProps.post.user_id), - status: getStatusForUserId(state, ownProps.post.user_id), + user: getUser(state, detailedPost.user_id), + status: getStatusForUserId(state, detailedPost.user_id), currentUser: getCurrentUser(state), isFirstReply: Boolean(detailedPost.isFirstReply && detailedPost.commentedOnPost), highlight: detailedPost.highlight, |