diff options
-rw-r--r-- | webapp/components/post_view/post_view_controller.jsx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/webapp/components/post_view/post_view_controller.jsx b/webapp/components/post_view/post_view_controller.jsx index e053db118..a18a73b86 100644 --- a/webapp/components/post_view/post_view_controller.jsx +++ b/webapp/components/post_view/post_view_controller.jsx @@ -191,8 +191,19 @@ export default class PostViewController extends React.Component { onPostsViewJumpRequest(type, postId) { switch (type) { case Constants.PostsViewJumpTypes.BOTTOM: { + 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 + }); break; } case Constants.PostsViewJumpTypes.POST: |