FIX: Jumping to a post that doesn't exist should jump to closest

This commit is contained in:
Robin Ward 2017-05-03 13:23:55 -04:00
parent bff36de130
commit 09cb61b533

View File

@ -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
};