Fixed being unable to make the first post in a new channel (#4744)

This commit is contained in:
Harrison Healey
2016-12-09 07:53:36 -05:00
committed by Joram Wilander
parent 5341e82ad7
commit d7ee335106

View File

@@ -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: