2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
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-09-13 17:14:46 -04:00
|
|
|
:category_id,
|
2017-06-21 12:56:38 -04:00
|
|
|
: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
|
|
|
|
2017-09-13 17:14:46 -04:00
|
|
|
def category_id
|
|
|
|
object.topic.category_id
|
2014-11-14 19:30:05 -05:00
|
|
|
end
|
2014-02-07 10:44:03 -05:00
|
|
|
end
|