2015-04-10 17:00:50 -04:00
|
|
|
class QueuedPostSerializer < ApplicationSerializer
|
2015-04-14 14:21:02 -04:00
|
|
|
|
2015-04-10 17:00:50 -04:00
|
|
|
attributes :id,
|
|
|
|
:queue,
|
|
|
|
:user_id,
|
|
|
|
:state,
|
|
|
|
:topic_id,
|
|
|
|
:approved_by_id,
|
|
|
|
:rejected_by_id,
|
|
|
|
:raw,
|
|
|
|
:post_options,
|
2015-04-15 15:29:37 -04:00
|
|
|
:created_at,
|
|
|
|
:category_id
|
2015-04-10 17:00:50 -04:00
|
|
|
|
2015-04-20 16:18:00 -04:00
|
|
|
has_one :user, serializer: BasicUserSerializer
|
2015-04-14 14:21:02 -04:00
|
|
|
has_one :topic, serializer: BasicTopicSerializer
|
|
|
|
|
2015-04-15 15:29:37 -04:00
|
|
|
def category_id
|
|
|
|
cat_id = object.topic.try(:category_id) || object.post_options['category']
|
|
|
|
cat_id.to_i if cat_id
|
|
|
|
end
|
|
|
|
|
|
|
|
def include_category_id?
|
|
|
|
category_id.present?
|
|
|
|
end
|
|
|
|
|
2015-04-10 17:00:50 -04:00
|
|
|
end
|