mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-04 12:51:41 -05:00
24 lines
608 B
Ruby
24 lines
608 B
Ruby
class SuggestedTopicSerializer < ListableTopicSerializer
|
|
|
|
# need to embed so we have users
|
|
# front page json gets away without embedding
|
|
class SuggestedPosterSerializer < ApplicationSerializer
|
|
attributes :extras, :description
|
|
has_one :user, serializer: BasicUserSerializer, embed: :objects
|
|
end
|
|
|
|
attributes :archetype, :like_count, :views, :category_id, :tags
|
|
has_many :posters, serializer: SuggestedPosterSerializer, embed: :objects
|
|
|
|
def posters
|
|
object.posters || []
|
|
end
|
|
|
|
def include_tags?
|
|
SiteSetting.tagging_enabled
|
|
end
|
|
|
|
def tags
|
|
object.tags.map(&:name)
|
|
end
|
|
end
|