Skip to content

A platform for community discussion. Free, open, simple.

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

Krzysztof Kotlarek81c216e04c13
diff --git a/app/serializers/topic_list_item_serializer.rb b/app/serializers/topic_list_item_serializer.rb
index 7962c400c03..d0cff44cb8f 100644
--- a/app/serializers/topic_list_item_serializer.rb
+++ b/app/serializers/topic_list_item_serializer.rb
@@ -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
diff --git a/spec/serializers/topic_list_item_serializer_spec.rb b/spec/serializers/topic_list_item_serializer_spec.rb
index 1ca54ef3117..72acb82aef4 100644
--- a/spec/serializers/topic_list_item_serializer_spec.rb
+++ b/spec/serializers/topic_list_item_serializer_spec.rb
@@ -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