summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2017-01-16 16:51:46 -0500
committerHarrison Healey <harrisonmhealey@gmail.com>2017-01-16 16:51:46 -0500
commit7c9d0c313f8ba935cfd5c33137c6cbdd1c1e6604 (patch)
treee80b0f7452f9500076616670c5e7deb6792ff66e
parent441fe5334e63ab06be25c0c7edccf60b5018e2db (diff)
downloadchat-7c9d0c313f8ba935cfd5c33137c6cbdd1c1e6604.tar.gz
chat-7c9d0c313f8ba935cfd5c33137c6cbdd1c1e6604.tar.bz2
chat-7c9d0c313f8ba935cfd5c33137c6cbdd1c1e6604.zip
PLT-5173 fixing javascript error when creating DM on Android (#5077)
-rw-r--r--webapp/components/post_view/post_view_controller.jsx10
1 files changed, 9 insertions, 1 deletions
diff --git a/webapp/components/post_view/post_view_controller.jsx b/webapp/components/post_view/post_view_controller.jsx
index a18a73b86..a18d0ac38 100644
--- a/webapp/components/post_view/post_view_controller.jsx
+++ b/webapp/components/post_view/post_view_controller.jsx
@@ -229,8 +229,16 @@ export default class PostViewController extends React.Component {
onPostListScroll(atBottom) {
if (atBottom) {
+ let lastViewedBottom;
const lastPost = PostStore.getLatestPost(this.state.channel.id);
- this.setState({scrollType: ScrollTypes.BOTTOM, lastViewedBottom: lastPost.create_at || new Date().getTime()});
+
+ if (lastPost && lastPost.create_at) {
+ lastViewedBottom = lastPost.create_at;
+ } else {
+ lastViewedBottom = new Date().getTime();
+ }
+
+ this.setState({scrollType: ScrollTypes.BOTTOM, lastViewedBottom});
} else {
this.setState({scrollType: ScrollTypes.FREE});
}