diff options
Diffstat (limited to 'webapp/components/post_view')
-rw-r--r-- | webapp/components/post_view/components/post_list.jsx | 15 | ||||
-rw-r--r-- | webapp/components/post_view/post_focus_view_controller.jsx | 1 |
2 files changed, 10 insertions, 6 deletions
diff --git a/webapp/components/post_view/components/post_list.jsx b/webapp/components/post_view/components/post_list.jsx index 28be93544..c23f785d9 100644 --- a/webapp/components/post_view/components/post_list.jsx +++ b/webapp/components/post_view/components/post_list.jsx @@ -68,7 +68,7 @@ export default class PostList extends React.Component { const childNodes = this.refs.postlistcontent.childNodes; for (let i = 0; i < childNodes.length; i++) { // If the node is 1/3 down the page - if (childNodes[i].offsetTop > (this.refs.postlist.scrollTop + (this.refs.postlist.offsetHeight / Constants.SCROLL_PAGE_FRACTION))) { + if (childNodes[i].offsetTop >= (this.refs.postlist.scrollTop + (this.refs.postlist.offsetHeight / Constants.SCROLL_PAGE_FRACTION))) { this.jumpToPostNode = childNodes[i]; break; } @@ -137,7 +137,10 @@ export default class PostList extends React.Component { } loadMorePostsTop() { - GlobalActions.emitLoadMorePostsEvent(); + if (this.props.isFocusPost) { + return GlobalActions.emitLoadMorePostsFocusedTopEvent(); + } + return GlobalActions.emitLoadMorePostsEvent(); } loadMorePostsBottom() { @@ -364,9 +367,8 @@ export default class PostList extends React.Component { } } else if (this.refs.postlist.scrollHeight !== this.prevScrollHeight) { window.requestAnimationFrame(() => { - // Only need to jump if we added posts to the top. - if (this.jumpToPostNode && (this.jumpToPostNode.offsetTop !== this.prevOffsetTop)) { - this.refs.postlist.scrollTop += (this.refs.postlist.scrollHeight - this.prevScrollHeight); + if (this.jumpToPostNode) { + this.refs.postlist.scrollTop += (this.jumpToPostNode.offsetTop - this.prevOffsetTop); } }); } @@ -522,5 +524,6 @@ PostList.propTypes = { displayNameType: React.PropTypes.string, displayPostsInCenter: React.PropTypes.bool, compactDisplay: React.PropTypes.bool, - previewsCollapsed: React.PropTypes.string + previewsCollapsed: React.PropTypes.string, + isFocusPost: React.PropTypes.bool }; diff --git a/webapp/components/post_view/post_focus_view_controller.jsx b/webapp/components/post_view/post_focus_view_controller.jsx index 7c1da6566..c70ebb0f5 100644 --- a/webapp/components/post_view/post_focus_view_controller.jsx +++ b/webapp/components/post_view/post_focus_view_controller.jsx @@ -115,6 +115,7 @@ export default class PostFocusView extends React.Component { showMoreMessagesTop={!this.state.atTop} showMoreMessagesBottom={!this.state.atBottom} postsToHighlight={postsToHighlight} + isFocusPost={true} /> ); } |