mirror of
https://github.com/discourse/discourse.git
synced 2025-02-04 11:35:16 +08:00
b380ed5282
This is a feature that used to be present in discourse-assign but is much easier to implement in core. It also allows a topic to be assigned without it claiming for review and vice versa and allows it to work with category group reviewers.
31 lines
490 B
Ruby
31 lines
490 B
Ruby
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
|