discourse/app/serializers/group_post_serializer.rb

25 lines
545 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require_relative "post_item_excerpt"
class GroupPostSerializer < ApplicationSerializer
include PostItemExcerpt
attributes :id, :created_at, :title, :url, :category_id, :post_number, :topic_id, :post_type
has_one :user, serializer: GroupPostUserSerializer, embed: :object
2016-12-05 04:12:24 -06:00
has_one :topic, serializer: BasicTopicSerializer, embed: :object
def title
object.topic.title
end
def include_user_long_name?
SiteSetting.enable_names?
end
def category_id
object.topic.category_id
end
end