FIX: Suggested Topics had a hardcoded 5 and was ignoring the

SiteSetting
This commit is contained in:
Robin Ward 2014-03-10 15:36:45 -04:00
parent f5e6bcc585
commit 9929560c40
2 changed files with 15 additions and 15 deletions

View File

@ -107,21 +107,19 @@ 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)
var existing = _.invoke(suggested, 'get', 'id'),
lookup = _.chain(incoming)
.last(Discourse.SiteSettings.suggested_topics)
.reverse()
.union(existing)
.uniq()
.without(topicId)
.first(5)
.first(Discourse.SiteSettings.suggested_topics)
.value();
Discourse.TopicList.loadTopics(lookup, "").then(function(topics){

View File

@ -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