Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/serializers/build_entity.rb')
-rw-r--r--app/serializers/build_entity.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/serializers/build_entity.rb b/app/serializers/build_entity.rb
index b804d6d0e8a..e2276808b90 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: -> (*) { 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? && 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