FIX: Keep current filter while navigating posts in a topic (#12620)
This commit is contained in:
parent
75a0d9aa01
commit
34596beb52
|
@ -754,6 +754,7 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||
jumpTop() {
|
||||
DiscourseURL.routeTo(this.get("model.firstPostUrl"), {
|
||||
skipIfOnScreen: false,
|
||||
keepFilter: true,
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -764,6 +765,7 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||
DiscourseURL.routeTo(this.get("model.lastPostUrl"), {
|
||||
skipIfOnScreen: false,
|
||||
jumpEnd,
|
||||
keepFilter: true,
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -774,6 +776,7 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||
);
|
||||
DiscourseURL.routeTo(this.get("model.lastPostUrl"), {
|
||||
jumpEnd: true,
|
||||
keepFilter: true,
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -1163,11 +1166,18 @@ export default Controller.extend(bufferedProperty("model"), {
|
|||
const post = postStream.findLoadedPost(postId);
|
||||
|
||||
if (post) {
|
||||
DiscourseURL.routeTo(topic.urlForPostNumber(post.get("post_number")));
|
||||
DiscourseURL.routeTo(topic.urlForPostNumber(post.get("post_number")), {
|
||||
keepFilter: true,
|
||||
});
|
||||
} else {
|
||||
// need to load it
|
||||
postStream.findPostsByIds([postId]).then((arr) => {
|
||||
DiscourseURL.routeTo(topic.urlForPostNumber(arr[0].get("post_number")));
|
||||
DiscourseURL.routeTo(
|
||||
topic.urlForPostNumber(arr[0].get("post_number")),
|
||||
{
|
||||
keepFilter: true,
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
@ -370,7 +370,9 @@ const DiscourseURL = EmberObject.extend({
|
|||
opts.nearPost = topicController.get("model.highest_post_number");
|
||||
}
|
||||
|
||||
opts.cancelFilter = true;
|
||||
if (!routeOpts.keepFilter) {
|
||||
opts.cancelFilter = true;
|
||||
}
|
||||
|
||||
postStream.refresh(opts).then(() => {
|
||||
const closest = postStream.closestPostNumberFor(opts.nearPost || 1);
|
||||
|
|
|
@ -223,7 +223,9 @@ export default createWidget("header-topic-info", {
|
|||
jumpToTopPost() {
|
||||
const topic = this.attrs.topic;
|
||||
if (topic) {
|
||||
DiscourseURL.routeTo(topic.get("firstPostUrl"));
|
||||
DiscourseURL.routeTo(topic.get("firstPostUrl"), {
|
||||
keepFilter: true,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue