diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /app/serializers/environment_serializer.rb | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'app/serializers/environment_serializer.rb')
-rw-r--r-- | app/serializers/environment_serializer.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/serializers/environment_serializer.rb b/app/serializers/environment_serializer.rb index 2bb9a7e7254..2fb1ad52135 100644 --- a/app/serializers/environment_serializer.rb +++ b/app/serializers/environment_serializer.rb @@ -23,6 +23,8 @@ class EnvironmentSerializer < BaseSerializer latest: super(item.latest, opts) } end else + resource = @paginator.paginate(resource) if paginated? + super(batch_load(resource), opts) end end @@ -52,7 +54,7 @@ class EnvironmentSerializer < BaseSerializer def batch_load(resource) resource = resource.preload(environment_associations) - resource.all.tap do |environments| + resource.all.to_a.tap do |environments| environments.each do |environment| # Batch loading the commits of the deployments environment.last_deployment&.commit&.try(:lazy_author) @@ -96,4 +98,4 @@ class EnvironmentSerializer < BaseSerializer # rubocop: enable CodeReuse/ActiveRecord end -EnvironmentSerializer.prepend_if_ee('EE::EnvironmentSerializer') +EnvironmentSerializer.prepend_mod_with('EnvironmentSerializer') |