discourse/app/serializers/group_post_serializer.rb
Sam Saffron 30990006a9 DEV: enable frozen string literal on all files
This reduces chances of errors where consumers of strings mutate inputs
and reduces memory usage of the app.

Test suite passes now, but there may be some stuff left, so we will run
a few sites on a branch prior to merging
2019-05-13 09:31:32 +08:00

31 lines
611 B
Ruby

# 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
has_one :user, serializer: GroupPostUserSerializer, embed: :object
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