summaryrefslogtreecommitdiff
path: root/app/models/deployment.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-10-06 13:10:50 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-10-06 13:16:34 +0200
commit3f85c3ef1629870e22f6a676585e8de80e5120c3 (patch)
tree141a1ef7d8fb0eaa79e203331d36671a60993070 /app/models/deployment.rb
parent2c01b19f8f55c7105506cdbe964d24d0a3c6dfc4 (diff)
downloadgitlab-ce-3f85c3ef1629870e22f6a676585e8de80e5120c3.tar.gz
Initial support for closing environments
Diffstat (limited to 'app/models/deployment.rb')
-rw-r--r--app/models/deployment.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/deployment.rb b/app/models/deployment.rb
index 82b27b78229..070c76339b1 100644
--- a/app/models/deployment.rb
+++ b/app/models/deployment.rb
@@ -77,6 +77,19 @@ class Deployment < ActiveRecord::Base
take
end
+ def close_action
+ return nil unless manual_actions
+
+ @close_action ||=
+ manual_actions.find do |manual_action|
+ manual_action.try(:closes_environment?, deployable.environment)
+ end
+ end
+
+ def closeable?
+ close_action.present?
+ end
+
private
def ref_path