mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 20:54:00 -06:00
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) {
|
||||
if (transition.targetName.indexOf("discovery.top") === -1 &&
|
||||
Discourse.User.currentProp("should_be_redirected_to_top")) {
|
||||
Discourse.User.currentProp("should_be_redirected_to_top", false);
|
||||
this.transitionTo("discovery.top");
|
||||
}
|
||||
},
|
||||
|
@ -39,6 +39,11 @@ Discourse.DiscoveryTopRoute = Discourse.Route.extend(Discourse.OpenComposer, {
|
||||
|
||||
actions: {
|
||||
|
||||
willTransition: function () {
|
||||
Discourse.User.currentProp("should_be_redirected_to_top", false);
|
||||
Discourse.User.currentProp("redirected_to_top_reason", null);
|
||||
},
|
||||
|
||||
createTopic: function() {
|
||||
this.openComposer(this.controllerFor('discovery/top'));
|
||||
}
|
||||
@ -110,6 +115,11 @@ Discourse.DiscoveryTopCategoryRoute = Discourse.Route.extend(Discourse.OpenCompo
|
||||
|
||||
actions: {
|
||||
|
||||
willTransition: function () {
|
||||
Discourse.User.currentProp("should_be_redirected_to_top", false);
|
||||
Discourse.User.currentProp("redirected_to_top_reason", null);
|
||||
},
|
||||
|
||||
createTopic: function() {
|
||||
this.openComposer(this.controllerFor('discovery/top'));
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
<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>
|
||||
{{/if}}
|
||||
{{#if content.yearly}}
|
||||
|
Loading…
Reference in New Issue
Block a user