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
path: root/lib/ci
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-12-19 22:24:38 +0300
committerLin Jen-Shin <godfat@godfat.org>2016-12-19 22:24:38 +0300
commit18c9fc42249a08ff28cf9d5b9159b7bada168bcf (patch)
tree0192fc7ed6a5302be252ceccf8028591b7ccb3c3 /lib/ci
parenta0690c4c01fceccef9efca70a9256f5790fba9c7 (diff)
Use a block to insert extra check for authenticate_build!
Feedback: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8091#note_20253762
Diffstat (limited to 'lib/ci')
-rw-r--r--lib/ci/api/helpers.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/ci/api/helpers.rb b/lib/ci/api/helpers.rb
index 62c10c3b753..31fbd1da108 100644
--- a/lib/ci/api/helpers.rb
+++ b/lib/ci/api/helpers.rb
@@ -14,13 +14,16 @@ module Ci
end
def authenticate_build!(build)
- not_found! unless build
- forbidden! unless build_token_valid?(build)
- validate_build!(build)
+ validate_build!(build) do
+ forbidden! unless build_token_valid?(build)
+ end
end
def validate_build!(build)
not_found! unless build
+
+ yield if block_given?
+
forbidden!('Project has been deleted!') unless build.project
forbidden!('Build has been erased!') if build.erased?
end