summaryrefslogtreecommitdiff
path: root/app/controllers/projects/environments_controller.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-10-18 12:02:50 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-10-18 12:02:50 +0200
commit0aa232704c5df68f0ed111e355a07cfaf241e8a9 (patch)
treee8e91070b0cde623325f6af596d9482ba0681cc6 /app/controllers/projects/environments_controller.rb
parent66ff67b063f2c8d06f40625595c4208c33ffd1f1 (diff)
downloadgitlab-ce-0aa232704c5df68f0ed111e355a07cfaf241e8a9.tar.gz
Add `stop!` to `environment`
Diffstat (limited to 'app/controllers/projects/environments_controller.rb')
-rw-r--r--app/controllers/projects/environments_controller.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb
index e243253c5f1..5837f913d16 100644
--- a/app/controllers/projects/environments_controller.rb
+++ b/app/controllers/projects/environments_controller.rb
@@ -9,8 +9,12 @@ class Projects::EnvironmentsController < Projects::ApplicationController
def index
@scope = params[:scope]
@all_environments = project.environments
- @environments = @scope == 'stopped' ?
- @all_environments.stopped : @all_environments.available
+ @environments =
+ if @scope == 'stopped' then
+ @all_environments.stopped
+ else
+ @all_environments.available
+ end
end
def show
@@ -45,8 +49,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController
def stop
return render_404 unless @environment.stoppable?
- action = @environment.stop_action
- new_action = action.active? ? action : action.play(current_user)
+ new_action = @environment.stop!(current_user)
redirect_to polymorphic_path([project.namespace.becomes(Namespace), project, new_action])
end