From 62592215f463c4ccdf6d07c7ba76239eb035415f Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 12 Feb 2014 11:31:11 -0500 Subject: [PATCH] FIX: Testing environment did NOT like `Discourse.URL` --- .../javascripts/discourse/views/discovery_topics_view.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/views/discovery_topics_view.js b/app/assets/javascripts/discourse/views/discovery_topics_view.js index 2801cae95..937af533b 100644 --- a/app/assets/javascripts/discourse/views/discovery_topics_view.js +++ b/app/assets/javascripts/discourse/views/discovery_topics_view.js @@ -26,8 +26,10 @@ Discourse.DiscoveryTopicsView = Discourse.View.extend(Discourse.LoadMore, { }, _readjustScrollPosition: function() { - var scrollTo = Discourse.Session.currentProp('topicListScrollPosition'); - if (Discourse.URL.get('router.url').indexOf('/more') === -1) { scrollTo = 0; } + var scrollTo = Discourse.Session.currentProp('topicListScrollPosition'), + url = document.location.href; + + if (url && url.indexOf('/more') === -1) { scrollTo = 0; } if (typeof scrollTo !== "undefined") { Em.run.schedule('afterRender', function() {