summaryrefslogtreecommitdiff
path: root/app/controllers/projects/environments_controller.rb
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-05-09 14:09:07 +0100
committerFilipa Lacerda <filipa@gitlab.com>2017-05-09 14:09:07 +0100
commit0c3abe3ef92fe4d982b780397e8ace37a51aca45 (patch)
tree4781ef63fa315d5a2a0edff6340d38e84db8847b /app/controllers/projects/environments_controller.rb
parentd3b124e473e051d424070b93c1e800fab7c08656 (diff)
parent387b44103c168d9a1b82997101deb60c61b6aaf1 (diff)
downloadgitlab-ce-31053-pipeline-ux.tar.gz
Merge branch 'master' into 31053-pipeline-ux31053-pipeline-ux
* master: Fallback to default pattern when note does not belong to project Merge request widget redesign Fixed focused test in notes spec Fixed UP arrow key not editing last comment in discussion Fix skipped manual actions issue in pipeline processing Fix notify_only_default_branch check for Slack service
Diffstat (limited to 'app/controllers/projects/environments_controller.rb')
-rw-r--r--app/controllers/projects/environments_controller.rb18
1 files changed, 12 insertions, 6 deletions
diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb
index fa37963dfd4..fd57afbd05f 100644
--- a/app/controllers/projects/environments_controller.rb
+++ b/app/controllers/projects/environments_controller.rb
@@ -17,7 +17,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController
format.json do
render json: {
environments: EnvironmentSerializer
- .new(project: @project, user: @current_user)
+ .new(project: @project, current_user: @current_user)
.with_pagination(request, response)
.within_folders
.represent(@environments),
@@ -37,7 +37,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController
format.json do
render json: {
environments: EnvironmentSerializer
- .new(project: @project, user: @current_user)
+ .new(project: @project, current_user: @current_user)
.with_pagination(request, response)
.represent(@environments),
available_count: folder_environments.available.count,
@@ -81,10 +81,16 @@ class Projects::EnvironmentsController < Projects::ApplicationController
stop_action = @environment.stop_with_action!(current_user)
- if stop_action
- redirect_to polymorphic_path([project.namespace.becomes(Namespace), project, stop_action])
- else
- redirect_to namespace_project_environment_path(project.namespace, project, @environment)
+ action_or_env_url =
+ if stop_action
+ polymorphic_url([project.namespace.becomes(Namespace), project, stop_action])
+ else
+ namespace_project_environment_url(project.namespace, project, @environment)
+ end
+
+ respond_to do |format|
+ format.html { redirect_to action_or_env_url }
+ format.json { render json: { redirect_url: action_or_env_url } }
end
end