FIX: Find the closest post to jump to if deleted

This commit is contained in:
Robin Ward 2016-12-27 10:52:37 -05:00
parent ee0c41b53a
commit 732d0ad030
1 changed files with 9 additions and 1 deletions

View File

@ -454,7 +454,15 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
},
jumpToPost(postNumber) {
this._jumpToPostId(this.get('model.postStream').findPostIdForPostNumber(postNumber));
const postStream = this.get('model.postStream');
let postId = postStream.findPostIdForPostNumber(postNumber);
// If we couldn't find the post, find the closest post to it
if (!postId) {
const closest = postStream.closestPostNumberFor(postNumber);
postId = postStream.findPostIdForPostNumber(closest);
}
this._jumpToPostId(postId);
},
jumpTop() {