Suggested topics includes closed and archived in new and unread, but not in random results

This commit is contained in:
Neil Lalonde
2014-02-04 12:26:38 -05:00
parent 359f03ca73
commit 9601684405
4 changed files with 27 additions and 11 deletions

View File

@@ -19,7 +19,7 @@ class SuggestedTopicsBuilder
# Only add results if we don't have those topic ids already
results = results.where('topics.id NOT IN (?)', @excluded_topic_ids)
.where(closed: false, archived: false, visible: true)
.where(visible: true)
.to_a
.reject { |topic| @category_topic_ids.include?(topic.id) }

View File

@@ -309,7 +309,7 @@ class TopicQuery
end
def random_suggested(topic, count, excluded_topic_ids=[])
result = default_results(unordered: true, per_page: count)
result = default_results(unordered: true, per_page: count).where(closed: false, archived: false)
excluded_topic_ids += Category.pluck(:topic_id).compact
result = result.where("topics.id NOT IN (?)", excluded_topic_ids) unless excluded_topic_ids.empty?