From 09cb61b533495e2ea4d88b5d6718f23ae523fea3 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 3 May 2017 13:23:55 -0400 Subject: [PATCH] FIX: Jumping to a post that doesn't exist should jump to closest --- app/assets/javascripts/discourse/lib/url.js.es6 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/lib/url.js.es6 b/app/assets/javascripts/discourse/lib/url.js.es6 index b92662e3682..1d74f02eccb 100644 --- a/app/assets/javascripts/discourse/lib/url.js.es6 +++ b/app/assets/javascripts/discourse/lib/url.js.es6 @@ -274,18 +274,17 @@ const DiscourseURL = Ember.Object.extend({ if (newMatches[3]) { opts.nearPost = newMatches[3]; } if (path.match(/last$/)) { opts.nearPost = topicController.get('model.highest_post_number'); } - const closest = opts.nearPost || 1; opts.cancelSummary = true; postStream.refresh(opts).then(() => { + const closest = postStream.closestPostNumberFor(opts.nearPost || 1); topicController.setProperties({ 'model.currentPost': closest, enteredAt: new Date().getTime().toString() }); this.appEvents.trigger('post:highlight', closest); - }).then(() => { const jumpOpts = { skipIfOnScreen: routeOpts.skipIfOnScreen };