mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Jumping to a post that doesn't exist should jump to closest
This commit is contained in:
parent
bff36de130
commit
09cb61b533
@ -274,18 +274,17 @@ const DiscourseURL = Ember.Object.extend({
|
|||||||
|
|
||||||
if (newMatches[3]) { opts.nearPost = newMatches[3]; }
|
if (newMatches[3]) { opts.nearPost = newMatches[3]; }
|
||||||
if (path.match(/last$/)) { opts.nearPost = topicController.get('model.highest_post_number'); }
|
if (path.match(/last$/)) { opts.nearPost = topicController.get('model.highest_post_number'); }
|
||||||
const closest = opts.nearPost || 1;
|
|
||||||
|
|
||||||
opts.cancelSummary = true;
|
opts.cancelSummary = true;
|
||||||
|
|
||||||
postStream.refresh(opts).then(() => {
|
postStream.refresh(opts).then(() => {
|
||||||
|
const closest = postStream.closestPostNumberFor(opts.nearPost || 1);
|
||||||
topicController.setProperties({
|
topicController.setProperties({
|
||||||
'model.currentPost': closest,
|
'model.currentPost': closest,
|
||||||
enteredAt: new Date().getTime().toString()
|
enteredAt: new Date().getTime().toString()
|
||||||
});
|
});
|
||||||
|
|
||||||
this.appEvents.trigger('post:highlight', closest);
|
this.appEvents.trigger('post:highlight', closest);
|
||||||
}).then(() => {
|
|
||||||
const jumpOpts = {
|
const jumpOpts = {
|
||||||
skipIfOnScreen: routeOpts.skipIfOnScreen
|
skipIfOnScreen: routeOpts.skipIfOnScreen
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user