2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-01-04 01:03:01 +08:00
|
|
|
class ReviewableTopicSerializer < ApplicationSerializer
|
|
|
|
attributes(
|
|
|
|
:id,
|
|
|
|
:title,
|
|
|
|
:fancy_title,
|
|
|
|
:slug,
|
|
|
|
:archived,
|
|
|
|
:closed,
|
|
|
|
:visible,
|
|
|
|
:archetype,
|
|
|
|
:relative_url,
|
|
|
|
:stats,
|
|
|
|
:reviewable_score
|
|
|
|
)
|
|
|
|
|
2019-05-08 22:20:51 +08:00
|
|
|
has_one :claimed_by, serializer: BasicUserSerializer, root: 'users'
|
|
|
|
|
2019-01-04 01:03:01 +08:00
|
|
|
def stats
|
|
|
|
@options[:stats][object.id]
|
|
|
|
end
|
2019-05-08 22:20:51 +08:00
|
|
|
|
|
|
|
def claimed_by
|
|
|
|
@options[:claimed_topics][object.id]
|
|
|
|
end
|
|
|
|
|
|
|
|
def include_claimed_by?
|
|
|
|
@options[:claimed_topics]
|
|
|
|
end
|
|
|
|
|
2019-01-04 01:03:01 +08:00
|
|
|
end
|