mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 09:33:37 +08:00
30990006a9
This reduces chances of errors where consumers of strings mutate inputs and reduces memory usage of the app. Test suite passes now, but there may be some stuff left, so we will run a few sites on a branch prior to merging
33 lines
521 B
Ruby
33 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
|