Commit 5051f654 authored by syasonik's avatar syasonik

Refactor envs helper for clarity

parent db054bc1
...@@ -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