Include pinned on Categories page

This commit is contained in:
Robin Ward 2013-04-03 11:45:53 -04:00
parent ac0bc1bb30
commit 459c7e3d59
2 changed files with 9 additions and 2 deletions

View File

@ -26,10 +26,11 @@ class CategoryFeaturedTopic < ActiveRecord::Base
WHERE ft.category_id = :category_id
AND ft.visible
AND ft.deleted_at IS NULL
AND ft.archetype <> '#{Archetype.private_message}'
AND ft.archetype <> :private_message
ORDER BY ft.bumped_at DESC
LIMIT :featured_limit",
category_id: c.id,
private_message: Archetype.private_message,
featured_limit: SiteSetting.category_featured_topics
end
end

View File

@ -1,6 +1,12 @@
require_dependency 'pinned_check'
class CategoryTopicSerializer < ListableTopicSerializer
attributes :visible, :closed, :archived
attributes :visible, :closed, :archived, :pinned
has_one :category
def pinned
PinnedCheck.new(object, object.user_data).pinned?
end
end