mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
workaround for bust up button on topics
This commit is contained in:
parent
8f892da890
commit
0f46df4670
1 changed files with 16 additions and 0 deletions
|
@ -48,6 +48,22 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
|||
|
||||
var postUrl = topic.get('url');
|
||||
if (current > 1) { postUrl += "/" + current; }
|
||||
// TODO: @Robin, this should all be integrated into the router,
|
||||
// the view should not be performing routing work
|
||||
//
|
||||
// This workaround ensures the router is aware the route changed,
|
||||
// without it, the up button was broken on long topics.
|
||||
// To repro, go to a topic with 50 posts, go to first post,
|
||||
// scroll to end, click up button ... nothing happens
|
||||
var handler =_.first(
|
||||
_.where(Discourse.URL.get("router.router.currentHandlerInfos"),
|
||||
function(o) {
|
||||
return o.name === "topic.fromParams";
|
||||
})
|
||||
);
|
||||
if(handler){
|
||||
handler.context = {nearPost: current};
|
||||
}
|
||||
Discourse.URL.replaceState(postUrl);
|
||||
}.observes('controller.currentPost', 'highest_post_number'),
|
||||
|
||||
|
|
Loading…
Reference in a new issue