diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2015-10-08 09:30:44 -0400 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2015-10-08 09:30:44 -0400 |
commit | 21bf9db56cf41e6f02e9f0e80cec997c94a0c726 (patch) | |
tree | f3871b2ffe331572bb1b4fa2d3af8b55254c6e17 /web/react/components/rhs_thread.jsx | |
parent | c189e2bb7681ba01edc9b8c5accd90b94c898d0a (diff) | |
parent | be8225b761a3009efd1097a0b4dd4d8f44830a33 (diff) | |
download | chat-21bf9db56cf41e6f02e9f0e80cec997c94a0c726.tar.gz chat-21bf9db56cf41e6f02e9f0e80cec997c94a0c726.tar.bz2 chat-21bf9db56cf41e6f02e9f0e80cec997c94a0c726.zip |
Merge pull request #948 from rgarmsen2295/plt-167
PLT-167 Fixes issue with trying to comment on a deleted post
Diffstat (limited to 'web/react/components/rhs_thread.jsx')
-rw-r--r-- | web/react/components/rhs_thread.jsx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/web/react/components/rhs_thread.jsx b/web/react/components/rhs_thread.jsx index 2f23d80d9..27a784701 100644 --- a/web/react/components/rhs_thread.jsx +++ b/web/react/components/rhs_thread.jsx @@ -23,7 +23,7 @@ export default class RhsThread extends React.Component { } getStateFromStores() { var postList = PostStore.getSelectedPost(); - if (!postList || postList.order.length < 1) { + if (!postList || postList.order.length < 1 || !postList.posts[postList.order[0]]) { return {postList: {}}; } @@ -49,7 +49,10 @@ export default class RhsThread extends React.Component { }.bind(this)); } componentDidUpdate() { - $('.post-right__scroll').scrollTop($('.post-right__scroll')[0].scrollHeight); + if ($('.post-right__scroll')[0]) { + $('.post-right__scroll').scrollTop($('.post-right__scroll')[0].scrollHeight); + } + $('.post-right__scroll').perfectScrollbar('update'); this.resize(); } @@ -67,7 +70,7 @@ export default class RhsThread extends React.Component { // if something was changed in the channel like adding a // comment or post then lets refresh the sidebar list var currentSelected = PostStore.getSelectedPost(); - if (!currentSelected || currentSelected.order.length === 0) { + if (!currentSelected || currentSelected.order.length === 0 || !currentSelected.posts[currentSelected.order[0]]) { return; } @@ -103,7 +106,7 @@ export default class RhsThread extends React.Component { render() { var postList = this.state.postList; - if (postList == null) { + if (postList == null || !postList.order) { return ( <div></div> ); |