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