summaryrefslogtreecommitdiff
path: root/lib/ci
diff options
context:
space:
mode:
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