2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-01-09 06:20:10 -06:00
|
|
|
require_relative "post_item_excerpt"
|
2017-06-21 11:56:38 -05:00
|
|
|
|
2014-02-07 09:44:03 -06:00
|
|
|
class GroupPostSerializer < ApplicationSerializer
|
2017-06-21 11:56:38 -05:00
|
|
|
include PostItemExcerpt
|
|
|
|
|
2023-01-09 06:20:10 -06:00
|
|
|
attributes :id, :created_at, :title, :url, :category_id, :post_number, :topic_id, :post_type
|
2014-02-07 09:44:03 -06:00
|
|
|
|
2016-12-05 04:46:23 -06:00
|
|
|
has_one :user, serializer: GroupPostUserSerializer, embed: :object
|
2016-12-05 04:12:24 -06:00
|
|
|
has_one :topic, serializer: BasicTopicSerializer, embed: :object
|
2014-02-07 09:44:03 -06:00
|
|
|
|
|
|
|
def title
|
|
|
|
object.topic.title
|
|
|
|
end
|
|
|
|
|
2014-02-12 13:23:10 -06:00
|
|
|
def include_user_long_name?
|
|
|
|
SiteSetting.enable_names?
|
|
|
|
end
|
2014-11-14 18:30:05 -06:00
|
|
|
|
2017-09-13 16:14:46 -05:00
|
|
|
def category_id
|
|
|
|
object.topic.category_id
|
2014-11-14 18:30:05 -06:00
|
|
|
end
|
2014-02-07 09:44:03 -06:00
|
|
|
end
|