Commit 0e1b3dc4 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Fix pipelines serializer with preloading pagination

parent f0d7445b
......@@ -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,
......@@ -20,6 +16,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