diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-05-06 20:17:02 +0300 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-05-06 20:17:02 +0300 |
commit | 6ad3814e1b31bfacfae7a2aabb4e4607b12ca66f (patch) | |
tree | b6024ca475dea081d9f38e4b14a2709d17af3a50 /app/models | |
parent | 2e6201b13197d03eafecd18d967ba7d55f664e19 (diff) | |
parent | fc121cca5ba87abd24afbc8da2f76e14e386e4c8 (diff) |
Merge branch 'feature/gb/manual-actions-protected-branches-permissions' into 'master'
Check access to a branch when user triggers manual action
Closes #20261
See merge request !10494
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/build.rb | 11 | ||||
-rw-r--r-- | app/models/deployment.rb | 4 |
2 files changed, 5 insertions, 10 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index b426c27afbb..971ab7cb0ee 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -111,14 +111,9 @@ module Ci end def play(current_user) - # Try to queue a current build - if self.enqueue - self.update(user: current_user) - self - else - # Otherwise we need to create a duplicate - Ci::Build.retry(self, current_user) - end + Ci::PlayBuildService + .new(project, current_user) + .execute(self) end def cancelable? diff --git a/app/models/deployment.rb b/app/models/deployment.rb index afad001d50f..37adfb4de73 100644 --- a/app/models/deployment.rb +++ b/app/models/deployment.rb @@ -85,8 +85,8 @@ class Deployment < ActiveRecord::Base end def stop_action - return nil unless on_stop.present? - return nil unless manual_actions + return unless on_stop.present? + return unless manual_actions @stop_action ||= manual_actions.find_by(name: on_stop) end |