FIX: automatic redirection to /top was a bit janky
This commit is contained in:
parent
b368667703
commit
d13d42f3f6
|
@ -14,6 +14,7 @@ Discourse.DiscoveryRoute = Discourse.Route.extend(Discourse.ScrollTop, Discourse
|
||||||
beforeModel: function(transition) {
|
beforeModel: function(transition) {
|
||||||
if (transition.targetName.indexOf("discovery.top") === -1 &&
|
if (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);
|
||||||
this.transitionTo("discovery.top");
|
this.transitionTo("discovery.top");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -39,6 +39,11 @@ Discourse.DiscoveryTopRoute = Discourse.Route.extend(Discourse.OpenComposer, {
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
||||||
|
willTransition: function () {
|
||||||
|
Discourse.User.currentProp("should_be_redirected_to_top", false);
|
||||||
|
Discourse.User.currentProp("redirected_to_top_reason", null);
|
||||||
|
},
|
||||||
|
|
||||||
createTopic: function() {
|
createTopic: function() {
|
||||||
this.openComposer(this.controllerFor('discovery/top'));
|
this.openComposer(this.controllerFor('discovery/top'));
|
||||||
}
|
}
|
||||||
|
@ -110,6 +115,11 @@ Discourse.DiscoveryTopCategoryRoute = Discourse.Route.extend(Discourse.OpenCompo
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
||||||
|
willTransition: function () {
|
||||||
|
Discourse.User.currentProp("should_be_redirected_to_top", false);
|
||||||
|
Discourse.User.currentProp("redirected_to_top_reason", null);
|
||||||
|
},
|
||||||
|
|
||||||
createTopic: function() {
|
createTopic: function() {
|
||||||
this.openComposer(this.controllerFor('discovery/top'));
|
this.openComposer(this.controllerFor('discovery/top'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="top-lists">
|
<div class="top-lists">
|
||||||
{{#if currentUser.should_be_redirected_to_top}}
|
{{#if currentUser.redirected_to_top_reason}}
|
||||||
<div class="alert alert-info">{{currentUser.redirected_to_top_reason}}</div>
|
<div class="alert alert-info">{{currentUser.redirected_to_top_reason}}</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if content.yearly}}
|
{{#if content.yearly}}
|
||||||
|
|
Loading…
Reference in New Issue