Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-11-10 15:59:26 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2016-11-10 15:59:26 +0300
commit1494abe982583c564969baaba7daa251ef333156 (patch)
tree681b777b50e645e6af0496bc808a2c071a4250ee /app/models/environment.rb
parent13a680e343bdcd905c9134c57202fdec7d436d96 (diff)
Allow to stop any environment
Diffstat (limited to 'app/models/environment.rb')
-rw-r--r--app/models/environment.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/app/models/environment.rb b/app/models/environment.rb
index 73f415c0ef0..5c662bbab87 100644
--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -85,13 +85,18 @@ class Environment < ActiveRecord::Base
external_url.gsub(/\A.*?:\/\//, '')
end
- def stoppable?
+ def can_run_stop_action?
available? && stop_action.present?
end
- def stop!(current_user)
- return unless stoppable?
+ def run_stop!(current_user)
+ return unless available?
- stop_action.play(current_user)
+ if stop_action.present?
+ stop_action.play(current_user)
+ else
+ stop
+ nil
+ end
end
end