2015-04-11 05:00:50 +08:00
|
|
|
class QueuedPostSerializer < ApplicationSerializer
|
2015-04-15 02:21:02 +08:00
|
|
|
|
2015-04-11 05:00:50 +08:00
|
|
|
attributes :id,
|
|
|
|
:queue,
|
|
|
|
:user_id,
|
|
|
|
:state,
|
|
|
|
:topic_id,
|
|
|
|
:approved_by_id,
|
|
|
|
:rejected_by_id,
|
|
|
|
:raw,
|
|
|
|
:post_options,
|
2015-04-16 03:29:37 +08:00
|
|
|
:created_at,
|
2015-05-20 00:19:25 +08:00
|
|
|
:category_id,
|
|
|
|
:can_delete_user
|
2015-04-11 05:00:50 +08:00
|
|
|
|
2015-08-04 10:56:20 +08:00
|
|
|
has_one :user, serializer: AdminUserListSerializer
|
2015-04-15 02:21:02 +08:00
|
|
|
has_one :topic, serializer: BasicTopicSerializer
|
|
|
|
|
2015-04-16 03:29:37 +08: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-05-20 00:19:25 +08:00
|
|
|
def can_delete_user
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def include_can_delete_user?
|
2016-05-20 18:14:19 +08:00
|
|
|
user && user.trust_level == TrustLevel[0]
|
2015-05-20 00:19:25 +08:00
|
|
|
end
|
|
|
|
|
2015-04-11 05:00:50 +08:00
|
|
|
end
|