diff --git a/app/serializers/post_stream_serializer_mixin.rb b/app/serializers/post_stream_serializer_mixin.rb index 02f9b582cc8..01f26cbd797 100644 --- a/app/serializers/post_stream_serializer_mixin.rb +++ b/app/serializers/post_stream_serializer_mixin.rb @@ -12,10 +12,18 @@ module PostStreamSerializerMixin true end + def include_gaps? + true + end + def post_stream result = { posts: posts } result[:stream] = object.filtered_post_ids if include_stream? - result[:gaps] = GapSerializer.new(object.gaps, root: false) if object.gaps.present? + + if include_gaps? && object.gaps.present? + result[:gaps] = GapSerializer.new(object.gaps, root: false) + end + result end diff --git a/app/serializers/topic_view_posts_serializer.rb b/app/serializers/topic_view_posts_serializer.rb index b51acf525f3..4fbd733051a 100644 --- a/app/serializers/topic_view_posts_serializer.rb +++ b/app/serializers/topic_view_posts_serializer.rb @@ -12,6 +12,10 @@ class TopicViewPostsSerializer < ApplicationSerializer false end + def include_gaps? + false + end + def include_timeline_lookup? false end diff --git a/spec/serializers/topic_view_posts_serializer_spec.rb b/spec/serializers/topic_view_posts_serializer_spec.rb index f69b4080645..39a3b30eec2 100644 --- a/spec/serializers/topic_view_posts_serializer_spec.rb +++ b/spec/serializers/topic_view_posts_serializer_spec.rb @@ -22,5 +22,6 @@ RSpec.describe TopicViewPostsSerializer do expect(posts.first["id"]).to eq(post.id) expect(body["post_stream"]["stream"]).to eq(nil) expect(body["post_stream"]["timeline_lookup"]).to eq(nil) + expect(body["post_stream"]["gaps"]).to eq(nil) end end