diff --git a/app/assets/javascripts/discourse/routes/discovery_route.js b/app/assets/javascripts/discourse/routes/discovery_route.js index adf69acb576..798629cd6dc 100644 --- a/app/assets/javascripts/discourse/routes/discovery_route.js +++ b/app/assets/javascripts/discourse/routes/discovery_route.js @@ -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"); } }, diff --git a/app/assets/javascripts/discourse/routes/discovery_top_routes.js b/app/assets/javascripts/discourse/routes/discovery_top_routes.js index 118f1f3f75f..456e2c70934 100644 --- a/app/assets/javascripts/discourse/routes/discovery_top_routes.js +++ b/app/assets/javascripts/discourse/routes/discovery_top_routes.js @@ -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')); } diff --git a/app/assets/javascripts/discourse/templates/discovery/top.js.handlebars b/app/assets/javascripts/discourse/templates/discovery/top.js.handlebars index cbd9825e9e9..27fbfbfe7cd 100644 --- a/app/assets/javascripts/discourse/templates/discovery/top.js.handlebars +++ b/app/assets/javascripts/discourse/templates/discovery/top.js.handlebars @@ -1,5 +1,5 @@
- {{#if currentUser.should_be_redirected_to_top}} + {{#if currentUser.redirected_to_top_reason}}
{{currentUser.redirected_to_top_reason}}
{{/if}} {{#if content.yearly}}