summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-10-17 15:40:18 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-10-17 15:40:18 +0200
commit50d3cc2b677dac855a6270f5ffed7085df8edcf8 (patch)
tree162f41cf99dfac5de554f0b6a967478e7790d465
parent18bb0a5696cd701d3a77c059fabb5d2f798f3a83 (diff)
downloadgitlab-ce-50d3cc2b677dac855a6270f5ffed7085df8edcf8.tar.gz
Remove destroy from environments [ci skip]
-rw-r--r--app/controllers/projects/environments_controller.rb16
-rw-r--r--config/routes/project.rb2
2 files changed, 4 insertions, 14 deletions
diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb
index 40da5be2e49..efdfbd24cae 100644
--- a/app/controllers/projects/environments_controller.rb
+++ b/app/controllers/projects/environments_controller.rb
@@ -2,8 +2,8 @@ class Projects::EnvironmentsController < Projects::ApplicationController
layout 'project'
before_action :authorize_read_environment!
before_action :authorize_create_environment!, only: [:new, :create]
- before_action :authorize_update_environment!, only: [:edit, :update, :stop, :destroy]
- before_action :environment, only: [:show, :edit, :update, :destroy]
+ before_action :authorize_update_environment!, only: [:edit, :update, :stop]
+ before_action :environment, only: [:show, :edit, :update, :stop]
def index
@scope = params[:scope]
@@ -47,17 +47,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController
def stop
action = @environment.stop_action
new_action = action.active? ? action : action.play(current_user)
- redirect_to [project.namespace.become(Namespace), project, new_action]
- end
-
- def destroy
- if @environment.destroy
- flash[:notice] = 'Environment was successfully removed.'
- else
- flash[:alert] = 'Failed to remove environment.'
- end
-
- redirect_to namespace_project_environments_path(project.namespace, project)
+ redirect_to [project.namespace.becomes(Namespace), project, new_action]
end
private
diff --git a/config/routes/project.rb b/config/routes/project.rb
index d73f76cd091..5e01d9a9e8f 100644
--- a/config/routes/project.rb
+++ b/config/routes/project.rb
@@ -318,7 +318,7 @@ resources :namespaces, path: '/', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only:
end
end
- resources :environments do
+ resources :environments, except: [:destroy] do
member do
post :stop
end