Commit e0837df8 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Fix pipelines serializer with preloading pagination

parent 3f76a976
......@@ -3,10 +3,6 @@ class PipelineSerializer < BaseSerializer
entity PipelineDetailsEntity
def represent(resource, opts = {})
if paginated? && !resource.respond_to?(:page)
raise Gitlab::Serializer::Pagination::InvalidResourceError
end
if resource.is_a?(ActiveRecord::Relation)
resource = resource.preload([
:stages,
......@@ -22,6 +18,10 @@ class PipelineSerializer < BaseSerializer
])
end
if paginated?
resource = paginator.paginate(resource)
end
if opts.delete(:preload)
resource = Gitlab::Ci::Pipeline::Preloader.preload!(resource)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment