summaryrefslogtreecommitdiffstats
path: root/webapp/components
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-12-09 07:53:36 -0500
committerJoram Wilander <jwawilander@gmail.com>2016-12-09 07:53:36 -0500
commitd7ee335106b4f3497d78f2e48d356f0ea89fea27 (patch)
treeaeb4bd7d039361aafbc3197d8f3f6b662819ea59 /webapp/components
parent5341e82ad74dfe40e8e18fb3f11401e9de417701 (diff)
downloadchat-d7ee335106b4f3497d78f2e48d356f0ea89fea27.tar.gz
chat-d7ee335106b4f3497d78f2e48d356f0ea89fea27.tar.bz2
chat-d7ee335106b4f3497d78f2e48d356f0ea89fea27.zip
Fixed being unable to make the first post in a new channel (#4744)
Diffstat (limited to 'webapp/components')
-rw-r--r--webapp/components/post_view/post_view_controller.jsx13
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: