diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-04-06 12:58:13 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-04-06 17:15:15 +0200 |
commit | 3dbef510c187606ef12eb9f2aaf51f30ddc3e30d (patch) | |
tree | 4c28e2c7fa41f8a677a3d9f138edef9f93093422 /app | |
parent | 5525db8b33bf1f76c4a8023ea4fb571d73e41b0f (diff) | |
download | gitlab-ce-3dbef510c187606ef12eb9f2aaf51f30ddc3e30d.tar.gz |
Expose manual action abilities from a build entity
Diffstat (limited to 'app')
-rw-r--r-- | app/serializers/build_entity.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/serializers/build_entity.rb b/app/serializers/build_entity.rb index b804d6d0e8a..401a277dadc 100644 --- a/app/serializers/build_entity.rb +++ b/app/serializers/build_entity.rb @@ -12,7 +12,7 @@ class BuildEntity < Grape::Entity path_to(:retry_namespace_project_build, build) end - expose :play_path, if: ->(build, _) { build.playable? } do |build| + expose :play_path, if: proc { playable? } do |build| path_to(:play_namespace_project_build, build) end @@ -25,11 +25,15 @@ class BuildEntity < Grape::Entity alias_method :build, :object - def path_to(route, build) - send("#{route}_path", build.project.namespace, build.project, build) + def playable? + build.playable? && build.can_play?(request.user) end def detailed_status build.detailed_status(request.user) end + + def path_to(route, build) + send("#{route}_path", build.project.namespace, build.project, build) + end end |