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