From 9929560c40b98b2de2c82c236a54a95fe515e60f Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 10 Mar 2014 15:36:45 -0400 Subject: [PATCH] FIX: Suggested Topics had a hardcoded 5 and was ignoring the SiteSetting --- .../javascripts/discourse/views/topic_view.js | 26 +++++++++---------- config/site_settings.yml | 4 ++- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/assets/javascripts/discourse/views/topic_view.js b/app/assets/javascripts/discourse/views/topic_view.js index 7f9d5f39baa..074e1a5ab6e 100644 --- a/app/assets/javascripts/discourse/views/topic_view.js +++ b/app/assets/javascripts/discourse/views/topic_view.js @@ -107,22 +107,20 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, { debounceLoadSuggested: Discourse.debounce(function(){ if (this.get('isDestroyed') || this.get('isDestroying')) { return; } - var incoming = this.get('topicTrackingState.newIncoming'); - var suggested = this.get('topic.details.suggested_topics'); - var topicId = this.get('topic.id'); + var incoming = this.get('topicTrackingState.newIncoming'), + suggested = this.get('topic.details.suggested_topics'), + topicId = this.get('topic.id'); if(suggested) { - - var existing = _.invoke(suggested, 'get', 'id'); - - var lookup = _.chain(incoming) - .last(5) - .reverse() - .union(existing) - .uniq() - .without(topicId) - .first(5) - .value(); + var existing = _.invoke(suggested, 'get', 'id'), + lookup = _.chain(incoming) + .last(Discourse.SiteSettings.suggested_topics) + .reverse() + .union(existing) + .uniq() + .without(topicId) + .first(Discourse.SiteSettings.suggested_topics) + .value(); Discourse.TopicList.loadTopics(lookup, "").then(function(topics){ suggested.clear(); diff --git a/config/site_settings.yml b/config/site_settings.yml index 8b06299ee59..ecbcfb374c6 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -47,7 +47,9 @@ basic: posts_per_page: client: true default: 20 - suggested_topics: 5 + suggested_topics: + client: true + default: 5 enable_mobile_theme: client: true default: true