FIX: composer problem on the categories page (#9508)

This commit is contained in:
Krzysztof Kotlarek 2020-04-23 02:24:54 +10:00 committed by GitHub
parent 04fb37c7a4
commit 81c216e04c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -21,7 +21,7 @@ class TopicListItemSerializer < ListableTopicSerializer
has_many :participants, serializer: TopicPosterSerializer, embed: :objects
def posters
object.posters || []
object.posters || object.posters_summary || []
end
def op_like_count

View File

@ -83,5 +83,15 @@ describe TopicListItemSerializer do
expect(json[:tags]).to eq([])
end
it 'return posters' do
json = TopicListItemSerializer.new(topic,
scope: Guardian.new(user),
hidden_tag_names: [hidden_tag.name],
root: false
).as_json
expect(json[:posters].length).to eq(1)
end
end
end