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