diff options
Diffstat (limited to 'app/serializers/build_entity.rb')
-rw-r--r-- | app/serializers/build_entity.rb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/app/serializers/build_entity.rb b/app/serializers/build_entity.rb index b804d6d0e8a..05dd8270e92 100644 --- a/app/serializers/build_entity.rb +++ b/app/serializers/build_entity.rb @@ -5,15 +5,15 @@ class BuildEntity < Grape::Entity expose :name expose :build_path do |build| - path_to(:namespace_project_build, build) + path_to(:namespace_project_job, build) end expose :retry_path do |build| - path_to(:retry_namespace_project_build, build) + path_to(:retry_namespace_project_job, build) end - expose :play_path, if: ->(build, _) { build.playable? } do |build| - path_to(:play_namespace_project_build, build) + expose :play_path, if: -> (*) { playable? } do |build| + path_to(:play_namespace_project_job, build) end expose :playable?, as: :playable @@ -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? && can?(request.current_user, :update_build, build) end def detailed_status - build.detailed_status(request.user) + build.detailed_status(request.current_user) + end + + def path_to(route, build) + send("#{route}_path", build.project.namespace, build.project, build) end end |