Commit 39abe2bb authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch '49388-refactor' into 'master'

Refactor helper in environments controller for clarity

See merge request gitlab-org/gitlab-ce!24781
parents ce36b109 5051f654
...@@ -182,11 +182,11 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -182,11 +182,11 @@ class Projects::EnvironmentsController < Projects::ApplicationController
end end
def serialize_environments(request, response, nested = false) def serialize_environments(request, response, nested = false)
serializer = EnvironmentSerializer EnvironmentSerializer
.new(project: @project, current_user: @current_user) .new(project: @project, current_user: @current_user)
.tap { |serializer| serializer.within_folders if nested }
.with_pagination(request, response) .with_pagination(request, response)
serializer = serializer.within_folders if nested .represent(@environments)
serializer.represent(@environments)
end end
def authorize_stop_environment! def authorize_stop_environment!
......
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