Don't include category definitions on Categories page

This commit is contained in:
Robin Ward 2014-02-07 17:01:31 -05:00
parent 33661b2d56
commit 350eb82223
3 changed files with 4 additions and 3 deletions

View file

@ -1,6 +1,6 @@
GIT
remote: https://github.com/dysania/onebox.git
revision: 3a96eb87c548baf8161362b6b36b58026b5a3946
revision: 6a2f6e6a08f183a4df52f9a51187f566b8ae3a00
specs:
onebox (1.1.0)
hexpress (~> 1.2)

View file

@ -20,7 +20,7 @@ class CategoryFeaturedTopic < ActiveRecord::Base
def self.feature_topics_for(c, existing=nil)
return if c.blank?
query = TopicQuery.new(self.fake_admin, per_page: SiteSetting.category_featured_topics, except_topic_ids: [c.topic_id], visible: true)
query = TopicQuery.new(self.fake_admin, per_page: SiteSetting.category_featured_topics, except_topic_ids: [c.topic_id], visible: true, no_definitions: true)
results = query.list_category(c).topic_ids
return if results == existing

View file

@ -19,6 +19,7 @@ class TopicQuery
sort_order
no_subcategories
sort_descending
no_definitions
status).map(&:to_sym)
# Maps `sort_order` to a columns in `topics`
@ -240,7 +241,7 @@ class TopicQuery
result = result.where('categories.name is null or categories.name <> ?', options[:exclude_category]).references(:categories) if options[:exclude_category]
# Don't include the category topic unless restricted to that category
if options[:category].blank?
if options[:category].blank? || options[:no_definitions]
result = result.where('COALESCE(categories.topic_id, 0) <> topics.id')
end