2014-02-07 10:44:03 -05:00
|
|
|
class GroupPostSerializer < ApplicationSerializer
|
|
|
|
attributes :id,
|
|
|
|
:cooked,
|
|
|
|
:created_at,
|
|
|
|
:title,
|
2014-02-12 14:23:10 -05:00
|
|
|
:url,
|
|
|
|
:user_title,
|
|
|
|
:user_long_name
|
2014-02-07 10:44:03 -05:00
|
|
|
|
|
|
|
has_one :user, serializer: BasicUserSerializer, embed: :objects
|
|
|
|
|
|
|
|
def title
|
|
|
|
object.topic.title
|
|
|
|
end
|
|
|
|
|
2014-02-12 14:23:10 -05:00
|
|
|
def user_long_name
|
|
|
|
object.user.try(:name)
|
|
|
|
end
|
|
|
|
|
|
|
|
def user_title
|
|
|
|
object.user.try(:title)
|
|
|
|
end
|
|
|
|
|
|
|
|
def include_user_long_name?
|
|
|
|
SiteSetting.enable_names?
|
|
|
|
end
|
2014-02-07 10:44:03 -05:00
|
|
|
end
|
|
|
|
|