mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 16:33:37 +08:00
32 lines
521 B
Ruby
32 lines
521 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ReviewableTopicSerializer < ApplicationSerializer
|
|
attributes(
|
|
:id,
|
|
:title,
|
|
:fancy_title,
|
|
:slug,
|
|
:archived,
|
|
:closed,
|
|
:visible,
|
|
:archetype,
|
|
:relative_url,
|
|
:stats,
|
|
:reviewable_score,
|
|
)
|
|
|
|
has_one :claimed_by, serializer: BasicUserSerializer, root: "users"
|
|
|
|
def stats
|
|
@options[:stats][object.id]
|
|
end
|
|
|
|
def claimed_by
|
|
@options[:claimed_topics][object.id]
|
|
end
|
|
|
|
def include_claimed_by?
|
|
@options[:claimed_topics]
|
|
end
|
|
end
|