diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-04-12 11:46:24 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-04-12 11:46:24 +0200 |
commit | 6c6bc400d1d8a96f6e443788cd0b2c14addd88e3 (patch) | |
tree | 81dd71fad366f25a7fa92638f50d9dc1ccf04835 /app/models | |
parent | b09465f38d66d7ff6074843177bcdb7d72caf07f (diff) | |
download | gitlab-ce-6c6bc400d1d8a96f6e443788cd0b2c14addd88e3.tar.gz |
Move code for playing an action to separate service
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/build.rb | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 159b3b2e101..9edc4cd96b9 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -122,18 +122,9 @@ module Ci end def play(current_user) - unless can_play?(current_user) - raise Gitlab::Access::AccessDeniedError - end - - # 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? |