FIX: Only redirect to top from root url.

This commit is contained in:
Sam 2015-04-02 12:51:32 +11:00
parent a764840794
commit 04bb1de057
1 changed files with 2 additions and 1 deletions

View File

@ -9,7 +9,8 @@ const DiscoveryRoute = Discourse.Route.extend(Discourse.ScrollTop, Discourse.Ope
redirect: function() { return this.redirectIfLoginRequired(); }, redirect: function() { return this.redirectIfLoginRequired(); },
beforeModel: function(transition) { beforeModel: function(transition) {
if (transition.targetName.indexOf("discovery.top") === -1 && if (transition.intent.url === "/" &&
transition.targetName.indexOf("discovery.top") === -1 &&
Discourse.User.currentProp("should_be_redirected_to_top")) { Discourse.User.currentProp("should_be_redirected_to_top")) {
Discourse.User.currentProp("should_be_redirected_to_top", false); Discourse.User.currentProp("should_be_redirected_to_top", false);
this.replaceWith("discovery.top"); this.replaceWith("discovery.top");