2017-06-21 12:56:38 -04:00
|
|
|
require_relative 'post_item_excerpt'
|
|
|
|
|
2014-02-07 10:44:03 -05:00
|
|
|
class GroupPostSerializer < ApplicationSerializer
|
2017-06-21 12:56:38 -04:00
|
|
|
include PostItemExcerpt
|
|
|
|
|
2014-02-07 10:44:03 -05:00
|
|
|
attributes :id,
|
|
|
|
:created_at,
|
|
|
|
:title,
|
2014-02-12 14:23:10 -05:00
|
|
|
:url,
|
2017-06-21 12:56:38 -04:00
|
|
|
:category,
|
|
|
|
:post_number,
|
|
|
|
:topic_id
|
2014-02-07 10:44:03 -05:00
|
|
|
|
2016-12-05 05:46:23 -05:00
|
|
|
has_one :user, serializer: GroupPostUserSerializer, embed: :object
|
2016-12-05 05:12:24 -05:00
|
|
|
has_one :topic, serializer: BasicTopicSerializer, embed: :object
|
2014-02-07 10:44:03 -05:00
|
|
|
|
|
|
|
def title
|
|
|
|
object.topic.title
|
|
|
|
end
|
|
|
|
|
2014-02-12 14:23:10 -05:00
|
|
|
def include_user_long_name?
|
|
|
|
SiteSetting.enable_names?
|
|
|
|
end
|
2014-11-14 19:30:05 -05:00
|
|
|
|
|
|
|
def category
|
|
|
|
object.topic.category
|
|
|
|
end
|
2014-02-07 10:44:03 -05:00
|
|
|
end
|